* gc.c (vm_malloc_increase): decrease it more carefully.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2013-10-29 07:49:43 +00:00
parent 97f0de6d90
commit 5aa527fade
2 changed files with 10 additions and 6 deletions

View File

@ -1,3 +1,7 @@
Tue Oct 29 16:49:03 2013 Koichi Sasada <ko1@atdot.net>
* gc.c (vm_malloc_increase): decrease it more carefully.
Tue Oct 29 16:24:52 2013 Koichi Sasada <ko1@atdot.net>
* gc.c (heap_page_resurrect): return a page in tomb heap even if

12
gc.c
View File

@ -5022,12 +5022,12 @@ vm_malloc_increase(rb_objspace_t *objspace, size_t new_size, size_t old_size, in
}
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;
}
}
}