summaryrefslogtreecommitdiff
path: root/ext/objspace
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-17 05:07:21 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-17 05:07:21 +0000
commit3f2828078273ec2b92afe27d3b081049bca2bcd2 (patch)
tree452db365d2dc6fdf0a2e2769b270e01fbc69f874 /ext/objspace
parented6231195b8c516a32019e1967366af7793e8313 (diff)
* 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
Diffstat (limited to 'ext/objspace')
-rw-r--r--ext/objspace/object_tracing.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/objspace/object_tracing.c b/ext/objspace/object_tracing.c
index 9de9724..1770a8e 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);
}