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. - 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). > > 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. -- 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/eclipseReceived on Fri May 24 23:01:53 2002
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:14 PM GMT GMT