Skip to content

Commit dfbfc80

Browse files
NickBarnesstedolan
andcommitted
Request a minor GC if marking has failed to start since the last slice.
Co-authored-by: Stephen Dolan <[email protected]>
1 parent 7c04f6f commit dfbfc80

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

runtime/major_gc.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,12 +1821,18 @@ static void major_collection_slice(intnat howmuch,
18211821

18221822
if (domain_state->sweeping_done) {
18231823
/* We do not immediately trigger a minor GC, but instead wait for
1824-
the next one to happen normally. This gives some chance that
1825-
other domains will finish sweeping as well. */
1824+
the next one to happen normally, when marking will start. This
1825+
gives some chance that other domains will finish sweeping as
1826+
well. */
18261827
request_mark_phase();
1828+
/* If there was no sweeping to do, but marking hasn't started,
1829+
then minor GC has not occurred naturally between major slices -
1830+
so we should force one now. */
1831+
if (sweep_work == 0 && !caml_marking_started()) {
1832+
caml_request_minor_gc();
1833+
}
18271834
}
18281835

1829-
18301836
mark_again:
18311837
if (caml_marking_started() &&
18321838
!domain_state->marking_done &&

0 commit comments

Comments
 (0)