Пример #1
0
CAMLprim value caml_gc_major(value v)
{                                                    Assert (v == Val_unit);
  caml_gc_log ("Major GC cycle requested");
  caml_ev_pause(EV_PAUSE_GC);
  caml_empty_minor_heap ();
  caml_finish_major_cycle();
  caml_final_do_calls ();
  caml_ev_resume();
  return Val_unit;
}
Пример #2
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);
}
Пример #3
0
CAMLprim value caml_gc_full_major(value v)
{
  int i;
  caml_gc_log ("Full Major GC requested");
  caml_ev_pause(EV_PAUSE_GC);
  /* In general, it can require up to 3 GC cycles for a
     currently-unreachable object to be collected. */
  for (i = 0; i < 3; i++) {
    caml_empty_minor_heap();
    caml_finish_major_cycle();
    caml_final_do_calls ();
  }
  caml_ev_resume();
  return Val_unit;
}
Пример #4
0
/* 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();
}