lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

I wrote:
> I patched luaC_step to print some stats after each call (see attachment).

Ok, so I tried this with the linked list example provided by John Skaller
and got interesting results. I generated a graph including the total and
estimated memory and the current threshold. See the attached images (compare
them side by side).

Memory consumption in non-incremental (full) mode seems reasonable, but
I see strange behaviour in incremental mode. Intuitively both graphs should
look almost the same except for the (short) sweep phases. But they don't.

Comparing the graphs it seems g->estimate is way off in incremental mode.
It doubles after every propagate phase (blue line jumps upwards) but the
sweep phase (downslide of all lines) does not reduce it fast enough before
another doubling sets in. Only after a few iterations of this enough sweep
steps are done in a row and then it goes down to a reasonable value (around
10% more than the estimate from a non-incremental run). And this cycle goes
on forever.

This may explain the huge maximum memory consumption of Lua 5.1 vs. 5.0
as observed in several postings on this list.

I think the problem is that the estimate is derived from the total memory
consumption after the propagate phase. But it really should be derived
from the total memory minus the memory (still) occupied by soon-to-be-dead
objects. See the end of atomic() in lgc.c.

Does this make sense?

Bye,
     Mike

Attachment: gcstat_full.png
Description: PNG image

Attachment: gcstat_inc.png
Description: PNG image