diff options
author | Koichi Sasada <ko1@cookpad.com> | 2019-05-16 16:44:30 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2019-05-16 17:18:50 +0900 |
commit | 88449100bc6d23a00dbf3addb97665f4f606f2b8 (patch) | |
tree | 3bc4cb6ddf5d6c6add65da5c9463260ba55730e3 /gc.c | |
parent | a160b2f56716f70fa3e485ae89875da48baefc1d (diff) | |
download | ruby-88449100bc6d23a00dbf3addb97665f4f606f2b8.tar.gz |
don't need to sweep rest.
`transient_heap_evacuate()` disables GC using `rb_gc_disable()`
to prohibt GC invocation because of new allocation for evacuated
memory. However, `rb_gc_disable()` sweep all rest of unswept pages.
We don't need to cancel lazy sweep so this patch introduce
`rb_gc_disable_no_rest()` which doesn't cancel lazy sweep.
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -8938,6 +8938,15 @@ rb_gc_enable(void) return old ? Qtrue : Qfalse; } +VALUE +rb_gc_disable_no_rest(void) +{ + rb_objspace_t *objspace = &rb_objspace; + int old = dont_gc; + dont_gc = TRUE; + return old ? Qtrue : Qfalse; +} + /* * call-seq: * GC.disable -> true or false @@ -8954,12 +8963,8 @@ VALUE rb_gc_disable(void) { rb_objspace_t *objspace = &rb_objspace; - int old = dont_gc; - gc_rest(objspace); - - dont_gc = TRUE; - return old ? Qtrue : Qfalse; + return rb_gc_disable_no_rest(); } static int |