diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | ext/objspace/object_tracing.c | 9 |
2 files changed, 14 insertions, 2 deletions
@@ -1,3 +1,10 @@ +Thu Oct 17 14:06:39 2013 Koichi Sasada <ko1@atdot.net> + + * ext/objspace/object_tracing.c (newobj_i): fix memory leak. + 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. + Thu Oct 17 12:30:16 2013 Tanaka Akira <akr@fsij.org> * lib/tsort.rb (TSort.each_strongly_connected_component_from): diff --git a/ext/objspace/object_tracing.c b/ext/objspace/object_tracing.c index 9de9724400..1770a8ea39 100644 --- a/ext/objspace/object_tracing.c +++ b/ext/objspace/object_tracing.c @@ -98,8 +98,13 @@ newobj_i(VALUE tpval, void *data) VALUE class_path = RTEST(klass) ? rb_class_path(klass) : Qnil; const char *class_path_cstr = RTEST(class_path) ? make_unique_str(arg->str_table, RSTRING_PTR(class_path), RSTRING_LEN(class_path)) : 0; - if (arg->keep_remains && st_lookup(arg->object_table, (st_data_t)obj, (st_data_t *)&info)) { - if (0 /* workaround */) if (info->living) rb_bug("newobj_i: reuse living object: %p", (void *)obj); + if (st_lookup(arg->object_table, (st_data_t)obj, (st_data_t *)&info)) { + if (arg->keep_remains) { + if (info->living) { + /* do nothing. there is possibility to keep living if FREEOBJ events while suppressing tracing */ + } + } + /* reuse info */ delete_unique_str(arg->str_table, info->path); delete_unique_str(arg->str_table, info->class_path); } |