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

From: Krzysztof Bordon <krzysztof.bordon_at_gmail.com>
Date: Sat, 25 Feb 2012 20:55:59 +0100
W dniu 25 lutego 2012 19:24 użytkownik Joachim Schimpf
<jschimpf_at_coninfer.com> napisał:
> 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
>

Thanks for your help. The trimcore predicate did the trick.

Best regards,
Krzysztof Bordon
Received on Sat Feb 25 2012 - 19:56:06 CET

This archive was generated by hypermail 2.2.0 : Wed Mar 07 2012 - 06:13:57 CET