From 164a93c8b745ae86f11a2a13524ab3cdc5367706 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 7 Sep 2018 08:28:57 +0000 Subject: object_tracing.c: register TracePoint objects * 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/objspace/object_tracing.c b/ext/objspace/object_tracing.c index 0c268b114a..dc9d6d4bb2 100644 --- a/ext/objspace/object_tracing.c +++ b/ext/objspace/object_tracing.c @@ -185,7 +185,9 @@ trace_object_allocations_start(VALUE self) else { if (arg->newobj_trace == 0) { arg->newobj_trace = rb_tracepoint_new(0, RUBY_INTERNAL_EVENT_NEWOBJ, newobj_i, arg); + rb_gc_register_mark_object(arg->newobj_trace); arg->freeobj_trace = rb_tracepoint_new(0, RUBY_INTERNAL_EVENT_FREEOBJ, freeobj_i, arg); + rb_gc_register_mark_object(arg->freeobj_trace); } rb_tracepoint_enable(arg->newobj_trace); rb_tracepoint_enable(arg->freeobj_trace); @@ -215,8 +217,6 @@ trace_object_allocations_stop(VALUE self) if (arg->running == 0) { rb_tracepoint_disable(arg->newobj_trace); rb_tracepoint_disable(arg->freeobj_trace); - arg->newobj_trace = 0; - arg->freeobj_trace = 0; } return Qnil; -- cgit v1.2.3