ObjectSpace.trace_object_allocations_start could crash since it adds a
TracePoint for when objects are freed. However, TracePoint could crash
since it modifies st tables while inside the GC that is trying to free
the object. This could cause a memory allocation to happen which would
crash if it triggers another GC.
See a crash log: http://ci.rvm.jp/results/trunk@ruby-sp1/4373707
The allocation tracing code keeps essentially a weak reference to
objects that have been allocated (storing the allocation information
along with the weak ref). Compacting the heap would break references in
this weak map, so the wrong values could be returned.
This commit just updates the values in the weak ref in order to fix the
allocation tracing book keeping
After 5e86b005c0, I now think ANYARGS is
dangerous and should be extinct. This commit deletes ANYARGS from
st_foreach. I strongly believe that this commit should have had come
with b0af0592fd, which added extra
parameter to st_foreach callbacks.
* ext/objspace/object_tracing.c (trace_object_allocations_start): to
prevent TracePoint objects from GC, register them in the VM, since
they are unique per VM.
http://ci.rvm.jp/results/trunk-test@ruby-sky3/1291901
* ext/objspace/object_tracing.c (trace_object_allocations_stop): reuse
TracePoint objects.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/objspace/object_tracing.c (allocation_sourceline): Fix
a class of a returned value. allocation_sourceline returns
an integer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/objspace/object_tracing.c (newobj_i): use cached class path
only to get rid object allocation during NEWOBJ hook.
[ruby-core:58853] [Bug #9212]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
is frozen.
rb_class_path() can modify frozen classes (and causes errors).
This patch is temporary. We need no-modification/no-allocation
class path function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
objectspace as json: ObjectSpace.dump_all and ObjectSpace.dump(obj).
These methods are useful for debugging reference leaks and memory growth
in large ruby applications. [Bug #9026] [ruby-core:57893] [Fixes GH-423]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
There is possibility to remain info due to missing FREEOBJ event.
FREEOBJ events are skipped while suppress_tracing state, for example,
during trace events are invoking.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
some bugs hits this check.
* ext/objspace/object_tracing.c (object_allocations_reporter_i): cast as pointer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
ObjectSpace.trace_object_allocations_debug_start for GC debugging.
If you encounter the BUG "... is T_NONE" (and so on) on your
application, please try this method at the beggining of your app.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ObjectSpace::trace_object_allocations_start
* ObjectSpace::trace_object_allocations_stop
* ObjectSpace::trace_object_allocations_clear
And some refactoring.
* test/objspace/test_objspace.rb: add a test for new methods.
* NEWS: add a description for new methods.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
lookup_allocation_info. At times I confused "struct
allocation_info" with "function allocation_info".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/objspace/object_tracing.c (make_unique_str): fix argument type.
use long for string length.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
"[ruby-core:55182] [ruby-trunk - Bug #8456][Open] Sugfault in Ruby Head"
Care about the case TracePoint#path #=> `nil'.
* ext/objspace/object_tracing.c: add two new methods:
* ObjectSpace.allocation_class_path(o)
* ObjectSpace.allocation_method_id(o)
They are not useful for Object.new because they are always
"Class" and :new.
To trace more useful information, we need to maintain call-tree
using call/return hooks, which is implemented by
ll-prof <http://sunagae.net/wiki/doku.php?id=software:llprof>
* test/objspace/test_objspace.rb: add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Read the following test to know HOWTO.
This feature is a sample of RUBY_INTERNAL_EVENT.
* test/objspace/test_objspace.rb: add a test.
* ext/objspace/object_tracing.c: ditto.
* gc.c (rb_gc_count): add. THis function returns GC count.
* internal.h: add decl. of rb_gc_count(). Same as `GC.count'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e