Re: turn off garbage collector?

From: Sebastian Sardina <ssardina_at_cs.toronto.edu>
Date: Fri 24 May 2002 10:24:48 AM GMT
Message-Id: <1022235888.3843.107.camel@sis-con.com.ar>
On Fri, 2002-05-24 at 18:01, Joachim Schimpf wrote:
> Sebastian Sardina wrote:
> > 
> > I have a very simple question: I have a predicate, say a/3, that is
> > usually very time-consumming. However, it runs much faster if I turn off
> > the garbage collector (GC)
> 
> Before switching the GC off completely, consider the following:
> 
> - if you are running an Eclipse < 5.3, you should upgrade.
>   Newer versions have a different default GC triggering policy
>   (controlled by the gc_policy flag) which should keep the overhead
>   down.
> 

I was using 5.3, but I will start using 5.4.


> - the GC triggering interval is determined by the flag gc_interval
>   (see get_flag/2,set_flag/2). If you increase this number, the GC
>   will trigger less often and use less time. The default setting is
>   a fraction of the initial global/trail stack limit ( -g option in
>   the command line eclipse, or preference setting in tkeclipse).
> 

ok I see, but if I want maximaze the speed of a special call then
switching it off and then on again is ok right? As long as I allocate
sufficient memory it is still safe.

> 
> > 
> > My question is: how should I do to turn the gc off first, call a/3, and
> > then turn the gc on again and still be "safe". Should I call the
> > GC explicitely after a/3 has finished or is it sufficient to turn the
> > flag on again? Something like:
> > 
> > main:- ......,
> >         set_flag(gc,off),  % Switch off GC
> >         a(..,..,..),       % Call a/3
> >         set_flag(gc,on),
> >         main.
> > 
> > After A is executed the GC is turned on. Is that ok or should I do
> > something else? Is it the case that a/3 may have left a lot of "garbage"
> > or does everything cleans up when a/3 succeeds?
> 
> set_flag(gc,on) will not necessarily cause the GC to run.
> You need to call garbage_collect/0 as well.
> 
> 

ok perfect!! I was suspecting that, thanks Joachim!

Sebastian


> -- 
>  Joachim Schimpf              /             phone: +44 20 7594 8187
>  IC-Parc, Imperial College   /            mailto:J.Schimpf@ic.ac.uk
>  London SW7 2AZ, UK         /    http://www.icparc.ic.ac.uk/eclipse
Received on Fri May 24 23:27:41 2002

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:14 PM GMT GMT