From pascal@rz.hu-berlin.de  Tue Feb 22 19:00:16 2000
Received: from suncom.rz.hu-berlin.de (suncom.rz.hu-berlin.de [141.20.1.31])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id TAA07735;
	Tue, 22 Feb 2000 19:00:16 +0100 (MET)
Received: from localhost.rz.hu-berlin.de (root@ppp196-6.rz.hu-berlin.de [141.20.196.6])
	by suncom.rz.hu-berlin.de (8.9.3/8.9.3) with ESMTP id TAA22905;
	Tue, 22 Feb 2000 19:00:01 +0100 (MET)
Received: (from pascal@localhost)
	by localhost (8.8.8/8.8.8/Debian/GNU) id TAA03525;
	Tue, 22 Feb 2000 19:00:39 +0100
Date: Tue, 22 Feb 2000 18:00:39 +0000 (GMT)
From: Pascal Vaillant <Pascal.Vaillant@rz.hu-berlin.de>
To: Jan Wielemaker <jan@swi.psy.uva.nl>
cc: prolog@swi.psy.uva.nl
Subject: Re: Mysterious memory allocation
In-Reply-To: <00022213194204.20611@gollem>
Message-ID: <Pine.LNX.4.05.10002221757230.3515-100000@torstrasse>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from QUOTED-PRINTABLE to 8bit by swi.psy.uva.nl id TAA07735


Dear Jan,

Thanks for your thorough answer. Some more discussion about it,
since it nearly raises philosophical issues...

>
> loop :-
>       _X = [hello, world],
>       loop.
>
> If this runs forever, getting a bit smaller and bigger as garbage
> is collected and produced, this mechanism is working fine on your
> os.
>

'loop' works as expected on my system, free memory being released
along as it is consumed.

> Further, memory consumption on first execution is hard to judge.
> Many things are created `lazy' (just-in-time).  If you look for
> memory leaks, write a program that should not consume any
> additional memory after completion and run it twice.  You will

There is a problem there. My file scanning function, if run twice
on the same file to look for the same term, 'burns' memory again.

> On my machine I couldn't find anything definitely wrong with your
> examples (SuSE Linux 6.3, kernel 2.2.13), though the claims in /proc
> are hard to interpret to me.
>

I can hear the boos in advance, but... let's tell it: my most recent
kernel update was to 2.0.38.

I find it annoying if the answer to the problem is upgrading. This
is why: not only because installing a new linux kernel always spoils
a day, but also because I hate to think that if I want to use my
program on another machine, I will also need to have the latest
OS version. Ideally the things I do with Prolog are simple and don't
deserve to be called big applications (compared to Age of Empires II
or anything...), so I thought it would be nice to make them portable.

In fact if it's just to work on my usual machine, I don't even need
this trick to read the terms in a file and assert only those that I
need: I can consult the whole set of files and let pl have them in
memory; it goes quite faster, costs 30 Mb of RAM, but I have them,
(and at least it doesn't get bigger afterwards), and moreover, if I
have well understood the explanations about only virtually reserving
the maximum number of pages in memory, it doesn't even *really* make
30 Mb unavailable for the OS and other applications.

I simply wanted to implement this trick in order to potentially be
able to run the same program on an older computer with 12Mb of RAM 
(when this was a big quantity of memory, not so long ago, we were  
already writing interesting programs, weren't we?) And after all,
when you think about it, it seems unreasonable to load large amounts
of data in RAM, when you only need a few portions of it at every
session, and can read them in files.

Anyway, if it's how the things are, I'll forget it (sadly). But first
I'm also going to see what it does on Windows and SunOS 4.1 (in the
antique shop).

Thanks anyway,

Pascal

--
Pascal Vaillant                                Jägerstraße 10/11
Humboldt Universität zu Berlin                 10117 Berlin (Allemagne)
Lehstuhl Computerlinguistik                    Tel: (+49/30) 20 19 25 54


