ruby-changes:28116
From: nagachika <ko1@a...>
Date: Sun, 7 Apr 2013 02:58:00 +0900 (JST)
Subject: [ruby-changes:28116] nagachika:r40168 (ruby_2_0_0): merge revision(s) 39812: [Backport #8147]
nagachika 2013-04-07 02:57:48 +0900 (Sun, 07 Apr 2013) New Revision: 40168 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40168 Log: merge revision(s) 39812: [Backport #8147] * gc.c: Improve accuracy of objspace_live_num() and allocated/freed counters. patched by tmm1(Aman Gupta). [Bug #8092] [ruby-core:53392] Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/gc.c branches/ruby_2_0_0/test/ruby/test_gc.rb branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 40167) +++ ruby_2_0_0/ChangeLog (revision 40168) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Sun Apr 7 02:54:40 2013 Narihiro Nakamura <authornari@g...> + + * gc.c: Improve accuracy of objspace_live_num() and + allocated/freed counters. patched by tmm1(Aman Gupta). + [Bug #8092] [ruby-core:53392] + Fri Apr 5 00:54:08 2013 NARUSE, Yui <naruse@r...> * ext/openssl/ossl_bn.c (ossl_bn_initialize): fix can't create from bn. Index: ruby_2_0_0/gc.c =================================================================== --- ruby_2_0_0/gc.c (revision 40167) +++ ruby_2_0_0/gc.c (revision 40168) @@ -1426,12 +1426,10 @@ finalize_list(rb_objspace_t *objspace, R https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/gc.c#L1426 while (p) { RVALUE *tmp = p->as.free.next; run_final(objspace, (VALUE)p); + objspace->total_freed_object_num++; if (!FL_TEST(p, FL_SINGLETON)) { /* not freeing page */ add_slot_local_freelist(objspace, p); - if (!is_lazy_sweeping(objspace)) { - objspace->total_freed_object_num++; - objspace->heap.free_num++; - } + objspace->heap.free_num++; } else { struct heaps_slot *slot = (struct heaps_slot *)(VALUE)RDATA(p)->dmark; @@ -1935,9 +1933,9 @@ slot_sweep(rb_objspace_t *objspace, stru https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/gc.c#L1933 else { sweep_slot->free_next = NULL; } - objspace->total_freed_object_num += freed_num; objspace->heap.free_num += freed_num + empty_num; } + objspace->total_freed_object_num += freed_num; objspace->heap.final_num += final_num; if (deferred_final_list && !finalizing) { @@ -2961,11 +2959,11 @@ rb_gc_force_recycle(VALUE p) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/gc.c#L2959 rb_objspace_t *objspace = &rb_objspace; struct heaps_slot *slot; + objspace->total_freed_object_num++; if (MARKED_IN_BITMAP(GET_HEAP_BITMAP(p), p)) { add_slot_local_freelist(objspace, (RVALUE *)p); } else { - objspace->total_freed_object_num++; objspace->heap.free_num++; slot = add_slot_local_freelist(objspace, (RVALUE *)p); if (slot->free_next == NULL) { Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 40167) +++ ruby_2_0_0/version.h (revision 40168) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2013-04-07" -#define RUBY_PATCHLEVEL 107 +#define RUBY_PATCHLEVEL 108 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 4 Index: ruby_2_0_0/test/ruby/test_gc.rb =================================================================== --- ruby_2_0_0/test/ruby/test_gc.rb (revision 40167) +++ ruby_2_0_0/test/ruby/test_gc.rb (revision 40168) @@ -64,6 +64,12 @@ class TestGc < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_gc.rb#L64 assert_equal(arg, res) assert_equal(false, res.empty?) assert_kind_of(Integer, res[:count]) + + stat, count = {}, {} + GC.start + GC.stat(stat) + ObjectSpace.count_objects(count) + assert_equal(count[:TOTAL]-count[:FREE], stat[:heap_live_num]) end def test_singleton_method Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r39812 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/