From paul@inet.co.za  Fri Jun  9 23:33:38 2000
Received: from exchange_rbk02.inet.co.za (exchange-rbk02.inet.co.za [196.38.91.22])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id XAA13782;
	Fri, 9 Jun 2000 23:33:34 +0200 (MET DST)
Received: from pdev.inet.co.za ([196.14.60.35]) by exchange_rbk02.inet.co.za with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21)
	id MMHDXDZ1; Fri, 9 Jun 2000 23:35:41 +0200
Date: Sat, 10 Jun 2000 01:22:56 +0200 (GMT+0200)
From: Paul Sephton <paul@inet.co.za>
To: Jan Wielemaker <jan@swi.psy.uva.nl>
cc: prolog@swi.psy.uva.nl
Subject: Re: Heap heaping up?
In-Reply-To: <00060913464900.09949@gollem>
Message-ID: <Pine.LNX.3.91.1000610010844.11867A-100000@pdev.inet.co.za>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII

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 (paul@inet.co.za)       Chief Systems Architect     I-Net Bridge 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ever wondered if jumping out of the frying pan might actually be refreshing?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

