Re: Memory consumption

From: Joachim Schimpf <j.schimpf_at_icparc.ic.ac.uk>
Date: Mon 31 Mar 2003 12:36:40 PM GMT
Message-ID: <3E883658.FC13DAF6@icparc.ic.ac.uk>
Sebastian Brand wrote:
> 
> Hello,
> 
> I have severe memory problems with Eclipse, Version 5.5 #63:
> 
> After some execution of my program, I get for instance
> 
> [eclipse 5]: statistics.
> .
> shared_heap_allocated:  118038528 bytes
> shared_heap_used:       11315984 bytes
> .
> .
> 
> so more than 100M, and looking at unix "top" confirms this.  First, I
> called eclipse with the option -s 50M to limit the size of the shared
> heap; second, I'm wondering what all this memory is used for.
> 
> My program dynamically creates, uses, and erases a specific module many
> times.  The module has a fixed interface predicate, but each time a few
> internal predicates (which themselves are generated by the ech library)
> are different.  Currently I write the module onto a stream and use then
> compile_stream.
> 
> 
> I understand that loading a module erases a previous version of it, but
> one explanation for the memory consumption above could be that the dead
> module's memory remains allocated.

This is because code memory is not eagerly freed because the
erased code may still be under execution. If you are sure that
this is not the case (i.e. the predicates you are erasing are
not currently being executed, and they have not left choicepoints
behind), you can call trimcore/0 after erasing the module.

A call to trimcore should also be preceded by a garbage
collection, so your code sequence should look like:

	erase_module(M), garbage_collect, trimcore

-- 
 Joachim Schimpf              /             phone: +44 20 7594 8187
 IC-Parc                     /      mailto:J.Schimpf@imperial.ac.uk
 Imperial College London    /    http://www.icparc.ic.ac.uk/eclipse
Received on Mon Mar 31 13:36:41 2003

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:08:20 PM GMT GMT