aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-07 18:03:12 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-07 18:03:12 +0000
commitbc319093665db0e8b4ed102e1bd093c5b0f04039 (patch)
treeefb773113c794090f7396315888f0785cf49f9ee
parent10b6409eb3c260189fc44c90110c7f33e85000e9 (diff)
downloadruby-bc319093665db0e8b4ed102e1bd093c5b0f04039.tar.gz
* gc.c (vm_malloc_increase): check GVL before gc_rest_sweep().
vm_malloc_increase() can be called without GVL. However, gc_rest_sweep() assumes acquiring GVL. To avoid this problem, check GVL before gc_rest_sweep(). [Bug #9090] This workaround introduces possibility to set malloc_limit as wrong value (*1). However, this may be rare case. So I commit it. *1: Without rest_sweep() here, gc_rest_sweep() can decrease malloc_increase due to ruby_sized_xfree(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog14
-rw-r--r--gc.c2
2 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 66628d5dc3..3f00ff3253 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Fri Nov 8 02:44:29 2013 Koichi Sasada <ko1@atdot.net>
+
+ * gc.c (vm_malloc_increase): check GVL before gc_rest_sweep().
+ vm_malloc_increase() can be called without GVL.
+ However, gc_rest_sweep() assumes acquiring GVL.
+ To avoid this problem, check GVL before gc_rest_sweep().
+ [Bug #9090]
+
+ This workaround introduces possibility to set malloc_limit as
+ wrong value (*1). However, this may be rare case. So I commit it.
+
+ *1: Without rest_sweep() here, gc_rest_sweep() can decrease
+ malloc_increase due to ruby_sized_xfree().
+
Fri Nov 8 02:50:25 2013 Zachary Scott <e@zzak.io>
* lib/securerandom.rb: [DOC] specify arguments passed to ::random_bytes
diff --git a/gc.c b/gc.c
index beaf22f147..a11d8f3075 100644
--- a/gc.c
+++ b/gc.c
@@ -5446,7 +5446,7 @@ vm_malloc_increase(rb_objspace_t *objspace, size_t new_size, size_t old_size, in
else {
retry:
if (malloc_increase > malloc_limit) {
- if (is_lazy_sweeping(heap_eden)) {
+ if (ruby_thread_has_gvl_p() && is_lazy_sweeping(heap_eden)) {
gc_rest_sweep(objspace); /* rest_sweep can reduce malloc_increase */
goto retry;
}