[mercury-users] Forcing garbage collection

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Dec 23 20:48:47 AEDT 2010


Hi,

On Thu, 23 Dec 2010, Michael Day wrote:

> Is it possible to force a garbage collection in asm_fast.gc?
>
> There is gc.garbage_collect, but if I'm reading it correctly it appears to be 
> a no-op in asm_fast.gc.

You are not reading it correctly.
The code is:

#ifdef MR_CONSERVATIVE_GC
   #ifndef MR_HIGHLEVEL_CODE
     /* clear out the stacks and registers before garbage collecting */
     MR_clear_zone_for_GC(MR_CONTEXT(MR_ctxt_detstack_zone), MR_sp + 1);
     MR_clear_zone_for_GC(MR_CONTEXT(MR_ctxt_nondetstack_zone),
         MR_maxfr + 1);
     MR_clear_regs_for_GC();
   #endif

     GC_gcollect();
#elif defined(MR_NATIVE_GC)
   #ifdef MR_HIGHLEVEL_CODE
     MR_garbage_collect();
   #else
     /* XXX not yet implemented */
   #endif
#endif

In asm_fast.gc, it will execute:

     MR_clear_zone_for_GC(MR_CONTEXT(MR_ctxt_detstack_zone), MR_sp + 1);
     MR_clear_zone_for_GC(MR_CONTEXT(MR_ctxt_nondetstack_zone),
         MR_maxfr + 1);
     MR_clear_regs_for_GC();
     GC_gcollect();

Julien.
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list