Skip to content

Commit

Permalink
Request a minor GC if marking has failed to start since the last slic…
Browse files Browse the repository at this point in the history
…e. (ocaml-flambda#3333)

Co-authored-by: Stephen Dolan <sdolan@janestreet.com>
  • Loading branch information
NickBarnes and stedolan authored Dec 3, 2024
1 parent 63526b7 commit eee3040
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions runtime/major_gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1799,12 +1799,18 @@ static void major_collection_slice(intnat howmuch,

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


mark_again:
if (caml_marking_started() &&
!domain_state->marking_done &&
Expand Down

0 comments on commit eee3040

Please sign in to comment.