/* Do a minor collection and a slice of major collection, call finalisation functions, etc. Leave the minor heap empty. */ CAMLexport void caml_minor_collection (void) { value *note_gc; uint64_t start_time; note_gc = caml_named_value("MProf.Trace.note_gc"); if (note_gc) start_time = NOW(); intnat prev_alloc_words = caml_allocated_words; caml_empty_minor_heap (); caml_stat_promoted_words += caml_allocated_words - prev_alloc_words; ++ caml_stat_minor_collections; caml_major_collection_slice (0); caml_force_major_slice = 0; caml_final_do_calls (); if (note_gc){ double duration_ns = (double) (NOW () - start_time); value result = caml_callback_exn(*note_gc, caml_copy_double(duration_ns / 1000000000)); if (Is_exception_result(result)) printk("warning: note_gc threw an exception!\n"); } caml_empty_minor_heap (); }
CAMLprim value caml_gc_major_slice (value v) { CAML_INSTR_SETUP (tmr, ""); Assert (Is_long (v)); caml_empty_minor_heap (); caml_major_collection_slice (Long_val (v)); CAML_INSTR_TIME (tmr, "explicit/gc_major_slice"); return Val_long (0); }
CAMLprim value caml_gc_major_slice (value v) { intnat res; CAMLassert (Is_long (v)); caml_ev_pause(EV_PAUSE_GC); caml_empty_minor_heap (); res = caml_major_collection_slice(Long_val(v), 0); caml_ev_resume(); caml_handle_gc_interrupt(); return Val_long (res); }
/* Do a minor collection and a slice of major collection, call finalisation functions, etc. Leave the minor heap empty. */ CAMLexport void caml_minor_collection (void) { caml_empty_minor_heap (); caml_major_collection_slice (0); caml_force_major_slice = 0; caml_final_do_calls (); caml_empty_minor_heap (); }
/* Do a minor collection and a slice of major collection, call finalisation functions, etc. Leave the minor heap empty. */ CAMLexport void caml_minor_collection (void) { caml_empty_minor_heap (); caml_major_collection_slice (0); caml_force_major_slice = 0; if (caml_finalise_begin_hook != NULL) (*caml_finalise_begin_hook) (); caml_final_do_calls (); if (caml_finalise_end_hook != NULL) (*caml_finalise_end_hook) (); caml_empty_minor_heap (); }
/* Do a minor collection and a slice of major collection, call finalisation functions, etc. Leave the minor heap empty. */ CAMLexport void caml_minor_collection (void) { intnat prev_alloc_words = caml_allocated_words; caml_empty_minor_heap (); caml_stat_promoted_words += caml_allocated_words - prev_alloc_words; ++ caml_stat_minor_collections; caml_major_collection_slice (0); caml_force_major_slice = 0; caml_final_do_calls (); caml_empty_minor_heap (); }
/* Do a minor collection and a slice of major collection, call finalisation functions, etc. Leave the minor heap empty. */ CAMLexport void caml_minor_collection (void) { caml_ev_pause(EV_PAUSE_GC); caml_handle_incoming_interrupts (); caml_empty_minor_heap (); caml_handle_incoming_interrupts (); caml_major_collection_slice (0, 0); caml_final_do_calls(); caml_ev_resume(); /* If the major slice triggered a STW, do that now */ caml_handle_gc_interrupt(); }
/* Do a minor collection and a slice of major collection, call finalisation functions, etc. Leave the minor heap empty. */ CAMLexport void caml_minor_collection (void) { /* !! intnat prev_alloc_words = caml_allocated_words; */ caml_log_event(EVENT_GC_START); caml_empty_minor_heap (); /* !! caml_stat_promoted_words += caml_allocated_words - prev_alloc_words; */ ++ caml_stat_minor_collections; caml_major_collection_slice (0); /* !! caml_final_do_calls (); */ caml_empty_minor_heap (); caml_log_event(EVENT_GC_END); }
CAMLprim value caml_gc_major_slice (value v) { Assert (Is_long (v)); caml_empty_minor_heap (); return Val_long (caml_major_collection_slice (Long_val (v))); }