1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2013-10-17 05:07:21 +00:00
parent ed6231195b
commit 3f28280782
2 changed files with 14 additions and 2 deletions

View file

@ -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):

View file

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