Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ruby 2.0 undefined method ObjectSpace.trace_object_allocations

tried this on ruby 2.0.0 / 247 or head:

require 'objspace'
ObjectSpace.trace_object_allocations -> undefined method `trace_object_allocations' 
for ObjectSpace:Module

Docs say it should work http://www.ruby-doc.org/stdlib-2.0/libdoc/objspace/rdoc/ObjectSpace.html any idea what I'm missing ?

like image 366
grosser Avatar asked Jul 26 '13 19:07

grosser


1 Answers

For higher ruby versions you still may get errors like:

undefined method `memsize_of' for ObjectSpace:Module

To solve this issue -> You need to require 'objspace'. According to https://ruby-doc.org/stdlib-2.3.1/libdoc/objspace/rdoc/ObjectSpace.html#method-c-memsize_of

like image 110
Daniel Garmoshka Avatar answered Sep 27 '22 23:09

Daniel Garmoshka