Skip to content

Commit

Permalink
flambda-backend: Ensure the minor heap is actually empty before reall…
Browse files Browse the repository at this point in the history
…ocating it (#2208)
  • Loading branch information
mshinwell authored Jan 5, 2024
1 parent 5eb9849 commit d1f82c4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion runtime/minor_gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,11 @@ void caml_set_minor_heap_size (asize_t wsize)

if (domain_state->young_ptr != domain_state->young_end) {
CAML_EV_COUNTER (EV_C_FORCE_MINOR_SET_MINOR_HEAP_SIZE, 1);
caml_minor_collection();
// Don't call caml_minor_collection, since that can run the
// caml_domain_external_interrupt_hook, which can allocate.
caml_empty_minor_heaps_once();
}
CAMLassert (domain_state->young_ptr == domain_state->young_end);

if(caml_reallocate_minor_heap(wsize) < 0) {
caml_fatal_error("Fatal error: No memory for minor heap");
Expand Down Expand Up @@ -759,7 +762,10 @@ caml_stw_empty_minor_heap_no_major_slice(caml_domain_state* domain,
#endif

CAML_EV_END(EV_MINOR_CLEAR);

caml_gc_log("finished stw empty_minor_heap");
CAMLassert(domain->young_ptr == domain->young_end);

Caml_state->in_minor_collection = 0;
}

Expand Down

0 comments on commit d1f82c4

Please sign in to comment.