Subject: Re: Mysterious memory allocation

From: Pascal Vaillant <[email-masked]>
Date: Tue, 22 Feb 2000 18:00:39 +0000 (GMT)

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