Check need_major_gc during GC stress
need_major_gc is set when a major GC is required. However, if gc_stress_no_major is also set, then it will not actually run a major GC. For example, the following script will sometimes crash: ``` GC.stress = 1 50000.times.map { [] } ``` With the following message: ``` [BUG] cannot create a new page after major GC ```
This commit is contained in:
parent
b8df6b9e01
commit
0dc40bd2b7
3
gc.c
3
gc.c
@ -9460,7 +9460,7 @@ gc_start(rb_objspace_t *objspace, unsigned int reason)
|
|||||||
|
|
||||||
objspace->flags.immediate_sweep = !(flag & (1<<gc_stress_no_immediate_sweep));
|
objspace->flags.immediate_sweep = !(flag & (1<<gc_stress_no_immediate_sweep));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if (objspace->rgengc.need_major_gc) {
|
if (objspace->rgengc.need_major_gc) {
|
||||||
reason |= objspace->rgengc.need_major_gc;
|
reason |= objspace->rgengc.need_major_gc;
|
||||||
do_full_mark = TRUE;
|
do_full_mark = TRUE;
|
||||||
@ -9471,7 +9471,6 @@ gc_start(rb_objspace_t *objspace, unsigned int reason)
|
|||||||
}
|
}
|
||||||
|
|
||||||
objspace->rgengc.need_major_gc = GPR_FLAG_NONE;
|
objspace->rgengc.need_major_gc = GPR_FLAG_NONE;
|
||||||
}
|
|
||||||
|
|
||||||
if (do_full_mark && (reason & GPR_FLAG_MAJOR_MASK) == 0) {
|
if (do_full_mark && (reason & GPR_FLAG_MAJOR_MASK) == 0) {
|
||||||
reason |= GPR_FLAG_MAJOR_BY_FORCE; /* GC by CAPI, METHOD, and so on. */
|
reason |= GPR_FLAG_MAJOR_BY_FORCE; /* GC by CAPI, METHOD, and so on. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user