mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/objspace/objspace.c (reachable_object_from_root_i): use
compare_by_identity hash to avoid hash modify problem during iteration. [Bug #9252] * ext/objspace/objspace.c (reachable_objects_from_root): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44241 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
295fe99059
commit
d4f80bd74e
2 changed files with 11 additions and 0 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
Mon Dec 16 19:12:54 2013 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* ext/objspace/objspace.c (reachable_object_from_root_i): use
|
||||||
|
compare_by_identity hash to avoid hash modify problem
|
||||||
|
during iteration.
|
||||||
|
[Bug #9252]
|
||||||
|
|
||||||
|
* ext/objspace/objspace.c (reachable_objects_from_root): ditto.
|
||||||
|
|
||||||
Mon Dec 16 18:16:28 2013 Koichi Sasada <ko1@atdot.net>
|
Mon Dec 16 18:16:28 2013 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* gc.c (gc_verify_internal_consistency): should not use
|
* gc.c (gc_verify_internal_consistency): should not use
|
||||||
|
|
|
@ -673,6 +673,7 @@ reachable_object_from_root_i(const char *category, VALUE obj, void *ptr)
|
||||||
data->last_category = category;
|
data->last_category = category;
|
||||||
category_str = data->last_category_str = rb_str_new2(category);
|
category_str = data->last_category_str = rb_str_new2(category);
|
||||||
category_objects = data->last_category_objects = rb_hash_new();
|
category_objects = data->last_category_objects = rb_hash_new();
|
||||||
|
rb_funcall(category_objects, rb_intern("compare_by_identity"), 0);
|
||||||
if (!NIL_P(rb_hash_lookup(data->categories, category_str))) {
|
if (!NIL_P(rb_hash_lookup(data->categories, category_str))) {
|
||||||
rb_bug("reachable_object_from_root_i: category should insert at once");
|
rb_bug("reachable_object_from_root_i: category should insert at once");
|
||||||
}
|
}
|
||||||
|
@ -711,6 +712,7 @@ reachable_objects_from_root(VALUE self)
|
||||||
VALUE hash = data.categories = rb_hash_new();
|
VALUE hash = data.categories = rb_hash_new();
|
||||||
data.last_category = 0;
|
data.last_category = 0;
|
||||||
|
|
||||||
|
rb_funcall(hash, rb_intern("compare_by_identity"), 0);
|
||||||
rb_objspace_reachable_objects_from_root(reachable_object_from_root_i, &data);
|
rb_objspace_reachable_objects_from_root(reachable_object_from_root_i, &data);
|
||||||
rb_hash_foreach(hash, collect_values_of_values, hash);
|
rb_hash_foreach(hash, collect_values_of_values, hash);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue