Re: [eclipse-clp-users] Error with Eclipse

From: Joachim Schimpf <jschimpf_at_...311...>
Date: Sat, 25 Feb 2012 19:24:36 +0100
Krzysztof Bordon wrote:
> Hello all,
> 
> I have similar problem as Matthew. I use embedded eclipse to
> repeatedly compile and execute over a dozen of thousands of smaller
> ecl programmes during one session of Eclipse CLP system and shortly
> come across run out of heap storage. Is there a way to occasionally
> purge the heap area ? I thought of using mem_fini() and mem_init()
> pair of functions but they don't seem to be designed to be run
> multiple times in one session. So is there a specific predicate or
> embedded function I should use in order to clean the heap space ?

You need to remove what you have compiled, and then call trimcore/0
to actually free the memory.

Your compiled predicates can be removed one-by-one using abolish/1,
but it is easier to have them all in a separate module, and remove
the whole module using erase_module/1.

So, if your current code looks like

... compile(File),      % File contains main/0 and other stuff
     call(main), ...

change it to something like

... create_module(m),
     compile(File)@m,
     call(main)@m,       % or safer: once(main)@m
     erase_module(m),
     trimcore, ...

Make sure you do the erase_module+trimcore only after you are sure
you will never return or backtrack into the removed code!  The code
space garbage collector that would make such precautions unnecessary
is still on the todo list...


-- Joachim
Received on Sat Feb 25 2012 - 18:51:25 CET

This archive was generated by hypermail 2.2.0 : Mon Jul 09 2018 - 02:05:29 CEST