summaryrefslogtreecommitdiff
path: root/test/test_weakref.rb
AgeCommit message (Collapse)Author
2012-11-24Fix WeakRef finalizeshirosaki
* array.c (rb_ary_delete_same_obj): new function for WeakRef. This deletes same objects as item argument in the array. * internal.h (rb_ary_delete_same_obj): add a declaration. * gc.c (wmap_final_func): remove WeakRef object reference from the array. rb_ary_delete() is not usable because it uses rb_equal() to compare object references. * gc.c (wmap_finalize): remove recycled object references from weak map hash properly. How to get object reference from object id was wrong. st_delete() doesn't work properly if key and value arguments are same. The key of obj2wmap is referenced object and the value of obj2wmap is WeakRef array. * gc.c (wmap_aset): obj2wmap should contain WeakRef array in the definition. * test/test_weakref.rb (TestWeakRef#test_not_reference_different_object, TestWeakRef#test_weakref_finalize): add tests for above. [ruby-core:49044] [Bug #7304] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-24Rvert r37827 and r37828naruse
Revert "Fix finalize of WeakRef" This causes segv on rubyspec. http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20121124T050101Z.log.html.gz you can reproduce by make test-rubyspec MSPECOPT='-V library/weakref' git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-24Fix finalize of WeakRefshirosaki
* gc.c (wmap_final_func): remove WeakRef object reference from the array. * gc.c (wmap_finalize): remove recycled object references from weak map hash properly. How to get object reference from object id was wrong. st_delete() doesn't work properly if key and value arguments are same. The key of obj2wmap is referenced object and the value of obj2wmap is WeakRef array. * gc.c (wmap_aset): obj2wmap should contain WeakRef array in the definition. * test/test_weakref.rb (TestWeakRef#test_not_reference_different_object): add a test for above. [ruby-core:49044] [Bug #7304] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-14more GCablenobu
* test/test_weakref.rb (make_weakref): more GCable, probably. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-13Bug #5350nobu
* gc.c: add ObjectSpace::WeakMap. [ruby-dev:44565][Bug #5350] * lib/weakref.rb: use WeakMap instead of _id2ref. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e