Subject: Re: Heap heaping up?

From: Paul Sephton <[email-masked]>
Date: Sat, 10 Jun 2000 01:22:56 +0200 (GMT+0200)

On Fri, 9 Jun 2000, Jan Wielemaker wrote:

> On Fri, 09 Jun 2000, Paul Sephton wrote:
> >When I run the following program, the heap just keeps getting bigger.  
> >Does the garbage collector have a memory leak?
> 
> The garbage collector doesn't do anything to the heap, it only
> affects the global- and trail-stacks.  Besides, the control-structure
> is failure driven, so all data created on the stacks in each iteration
> is destroyed anyhow on backtracking.
> 
> It seems there is a memory-leak in consult.  This doesn't really
> surprise me.  Consult is for loading sources and it does a lot of
> bookkeeping to deal with editing, re-consult, etc.  A small amount
> of leakage isn't too bad as source-files are loaded only once, or
> at most a few times during debugging.

_small_ leak??  this proggie doen't take long to reach 12MB of heap 
usage;  The odd thing is that it seems to happen spuriously-  a number of 
iterations, and then bang- another 4 MB or so (not K).

> In general, don't use consult/1 and friends for external storage
> of terms.  Simply use read and write for this.  Reading a file is
> easy:
....
> This way you avoid loosing dynamic declarations, the overhead
> of source-administration, macro-expansion, style-checking, etc.
> 
> 	Regards --- Jan

read_file/1 as you defined, works well in most instances, but meet the 
lazy programmer... I really don't like reinventing wheels.

I actually quite like consult dropping those predicates for me and also 
the automatic check for whether the file has changed.  It lets me 
interact between two instances of prolog quite nicely.

Ok, boss, I'll do it your way... or perhaps I'll go look for that leak 
myself :-)

Thanks, Paul.
_____________________________________________________________________________
Paul Sephton ([email-masked])       Chief Systems Architect     I-Net Bridge 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ever wondered if jumping out of the frying pan might actually be refreshing?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~