diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-29 07:49:43 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-29 07:49:43 +0000 |
commit | 5aa527fadee91ef03e4a3acb173b8da5f56a43ac (patch) | |
tree | 27d86b7dc523ead76e5d0d7057e213413f9afa0b /gc.c | |
parent | 97f0de6d90d9e804386f708172b5a75c277cb38c (diff) | |
download | ruby-5aa527fadee91ef03e4a3acb173b8da5f56a43ac.tar.gz |
* 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
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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; } } } |