Mike Lambert wote:
> Run languages/basic/basic.pl.
> Type "LOAD WUMPUS, and hit return.
> Type "RUN", and hit return.
> Type "N" and hit return.

The thot plickens!

My results for the above are:
Interpreter version              Time  Data size
CVS                                8s    1320kB
CVS + ML COW                      20s   19172kB
CVS + Grey1                        5s    1884kB
CVS + ML COW - reclaimable check   ??    5952kB

Time is approximate time from entering N to reaching user 
input stage.
Data size is measured when sleeping at the same point.
So I saw only a small increase in memory size with grey cows,
whereas you saw a much larger increase doing the same.

One culprit is the check in mem_allocate that does not
bother to compact the pool if the saving is insufficient.
Because you are under-estimating the reclaimable
amount, this check actually prevents the pool from
being compacted at all after a certain point during the
above test. The last line above reflects the results from
removing the two checks on reclaimable (threshold and size)

This problem does not exist in my version because I have
not bothered to adjust the reclaimable memory calculation,
as it changes again as part of the paged memory allocation
code that is next on my list to migrate from my old version to
my new version. I simply changed the code in compact_pool 
to ignore reclaimable for calculating the size to allocate, as
the simplest interim solution. This means I always overestimate
reclaimable, and therefore compact more often than I need to.

However, even with that problem bypassed, there is still a
major increase in memory usage. I put a few debugging
statements in resources.c to track block allocs and frees;
the value of interpreter->memory_allocated when wumpus
reaches its idle state waiting for user input are as follows:
CVS = 121,780
CVS + ML COW = 18,556,096
CVS + ML COW - reclaimable check = 2,197,359 (peak was about 6.2MB)

So the memory is definitely being allocated to the buffer
pool, not some other weird memory allocations somewhere.
I am still trying to track it down further - there is definitely
something very strange happening here somewhere.

I suspect a combination of slower and fatter may make it
hard to persuade Dan that we need cows?
-- 
Peter Gibbs
EmKel Systems


Reply via email to