diff --git a/ChangeLog b/ChangeLog index f9dc87de0d..9b9e81c079 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ -Mon Dec 9 12:25:32 2013 Nobuyoshi Nakada +Mon Dec 9 12:26:05 2013 Nobuyoshi Nakada + + * ext/objspace/object_tracing.c (newobj_i): use cached class path + only to get rid object allocation during NEWOBJ hook. + [ruby-core:58853] [Bug #9212] * variable.c (rb_class_path_cached): returns cached class path only, without searching and allocating new class path string. diff --git a/ext/objspace/object_tracing.c b/ext/objspace/object_tracing.c index ff45172af4..0ffdafb520 100644 --- a/ext/objspace/object_tracing.c +++ b/ext/objspace/object_tracing.c @@ -81,7 +81,7 @@ newobj_i(VALUE tpval, void *data) VALUE klass = rb_tracearg_defined_class(tparg); struct allocation_info *info; const char *path_cstr = RTEST(path) ? make_unique_str(arg->str_table, RSTRING_PTR(path), RSTRING_LEN(path)) : 0; - VALUE class_path = (RTEST(klass) && !OBJ_FROZEN(klass)) ? rb_class_path(klass) : Qnil; + VALUE class_path = (RTEST(klass) && !OBJ_FROZEN(klass)) ? rb_class_path_cached(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 (st_lookup(arg->object_table, (st_data_t)obj, (st_data_t *)&info)) {