mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* gc.c (gc_start): force to invoke GC by GC.start
even if it is GC.disable'd. * test/ruby/test_gc.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d5d997fa11
commit
121b6e064a
3 changed files with 20 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
Thu Nov 19 21:55:11 2015 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* gc.c (gc_start): force to invoke GC by GC.start
|
||||||
|
even if it is GC.disable'd.
|
||||||
|
|
||||||
|
* test/ruby/test_gc.rb: add a test.
|
||||||
|
|
||||||
Thu Nov 19 20:08:59 2015 Koichi Sasada <ko1@atdot.net>
|
Thu Nov 19 20:08:59 2015 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* gc.c: trivial performance improvements.
|
* gc.c: trivial performance improvements.
|
||||||
|
|
4
gc.c
4
gc.c
|
@ -6158,8 +6158,8 @@ gc_start(rb_objspace_t *objspace, const int full_mark, const int immediate_mark,
|
||||||
int do_full_mark = full_mark;
|
int do_full_mark = full_mark;
|
||||||
objspace->flags.immediate_sweep = immediate_sweep;
|
objspace->flags.immediate_sweep = immediate_sweep;
|
||||||
|
|
||||||
if (!heap_allocated_pages) return FALSE; /* heap is not ready */
|
if (!heap_allocated_pages) return FALSE; /* heap is not ready */
|
||||||
if (!ready_to_gc(objspace)) return TRUE; /* GC is not allowed */
|
if (reason != GPR_FLAG_METHOD && !ready_to_gc(objspace)) return TRUE; /* GC is not allowed */
|
||||||
|
|
||||||
if (RGENGC_CHECK_MODE) {
|
if (RGENGC_CHECK_MODE) {
|
||||||
assert(objspace->flags.stat == gc_stat_none);
|
assert(objspace->flags.stat == gc_stat_none);
|
||||||
|
|
|
@ -385,4 +385,15 @@ class TestGc < Test::Unit::TestCase
|
||||||
C.new
|
C.new
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_gc_disabled_start
|
||||||
|
begin
|
||||||
|
disabled = GC.disable
|
||||||
|
c = GC.count
|
||||||
|
GC.start
|
||||||
|
assert_equal 1, GC.count - c
|
||||||
|
ensure
|
||||||
|
GC.enable unless disabled
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue