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
This commit is contained in:
nobu 2018-09-07 08:28:57 +00:00
Родитель 68df2b0881
Коммит 164a93c8b7
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -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;