Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JRuby: NoMethodError: undefined method `memsize_of' for ObjectSpace:Module #8

Open
olleolleolle opened this issue May 30, 2022 · 2 comments

Comments

@olleolleolle
Copy link
Contributor

JRuby:

Script coverage disabled: unknown event: script_compiled

An error occurred while loading ./spec/rspec/memory_spec.rb.
Failure/Error: SLOT_SIZE = ObjectSpace.memsize_of(Object.new)

NoMethodError:
  undefined method `memsize_of' for ObjectSpace:Module
# ./lib/rspec/memory/trace.rb:26:in `block in Memory'
# ./lib/rspec/memory/trace.rb:25:in `<module:Memory>'
# ./lib/rspec/memory/trace.rb:24:in `<module:RSpec>'
# ./lib/rspec/memory/trace.rb:23:in `<main>'
# ./lib/rspec/memory/matchers/limit_allocations.rb:22:in `<main>'
# ./lib/rspec/memory.rb:21:in `<main>'
# ./spec/rspec/memory_spec.rb:21:in `<main>'
No examples found.

Finished in 0.00316 seconds (files took 1.62 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples
@olleolleolle
Copy link
Contributor Author

olleolleolle commented May 31, 2022

@enebo 👋 Hi, do you know whether this method is ever in the cards for JRuby? The only reference I could find of it was a 2019 comment on a "Update specs" PR, which mentioned it in output (with the same NoMethodError as above):

jruby/jruby#5747

@enebo
Copy link

enebo commented Jun 10, 2022

@olleolleolle it could be in a future release but it probably will not be a simple feature to add. Instrumentation seems to be the common way this is done (which means installing an agent) but even that by itself is only showing shallow object size (e.g. does not deep count all elements of an array as an example). I add a link to this since this might also be a solution: https://github.com/twitter-archive/commons/blob/master/src/java/com/twitter/common/objectsize/ObjectSizeCalculator.java

[NOTE: @olleolleolle I wrote this 10 days ago and never clicked on comment :( ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants