ruby-changes:31383
From: ko1 <ko1@a...>
Date: Tue, 29 Oct 2013 16:49:49 +0900 (JST)
Subject: [ruby-changes:31383] ko1:r43462 (trunk): * gc.c (vm_malloc_increase): decrease it more carefully.
ko1 2013-10-29 16:49:43 +0900 (Tue, 29 Oct 2013) New Revision: 43462 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43462 Log: * gc.c (vm_malloc_increase): decrease it more carefully. Modified files: trunk/ChangeLog trunk/gc.c Index: ChangeLog =================================================================== --- ChangeLog (revision 43461) +++ ChangeLog (revision 43462) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Oct 29 16:49:03 2013 Koichi Sasada <ko1@a...> + + * gc.c (vm_malloc_increase): decrease it more carefully. + Tue Oct 29 16:24:52 2013 Koichi Sasada <ko1@a...> * gc.c (heap_page_resurrect): return a page in tomb heap even if Index: gc.c =================================================================== --- gc.c (revision 43461) +++ gc.c (revision 43462) @@ -5022,12 +5022,12 @@ vm_malloc_increase(rb_objspace_t *objspa https://github.com/ruby/ruby/blob/trunk/gc.c#L5022 } else { size_t sub = old_size - new_size; - if (sub > 0) { - if (malloc_increase > sub) { - ATOMIC_SIZE_SUB(malloc_increase, sub); - } - else { - malloc_increase = 0; + if (sub != 0) { + retry_sub:; + { + size_t old_increase = malloc_increase; + size_t new_increase = old_increase > sub ? old_increase - sub : 0; + if (ATOMIC_SIZE_CAS(malloc_increase, old_increase, new_increase) != old_increase) goto retry_sub; } } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/