[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: "Random" delays in execution
- From: "Jerome Vuarand" <jerome.vuarand@...>
- Date: Fri, 7 Nov 2008 11:11:24 +0100
2008/11/7 Max van Rooij (van Rooij Electronics Design & Software
Engineering) <mvrooij@vanrooij-edse.nl>:
>>
>>With the GCCOLLECT the memory stays at 26kiB for the number version and
> at 231kiB for the userdata version. Without GCCOLLECT it
>>oscillates at respectively 29-47kiB and 234-253kiB (in sawtooth cycles
> with progressive increase and sudden decrease). In any case I >didn't
> notice any stall.
>
> Then we are almost there. As you can see in the script, nothing is done
> with any of the data. Yet, Lua increases the amount of memory needed,
> proportional to the size of the "cel" array. As you have seen, the
> memory increases steadyly until the preprogrammed limit of 150% initial
> mem-usage is reached and the GC kicks in. The only question that remains
> is, _why_? Why does Lua increase the amount of memory needed? Whats the
> logic behind this? A fixed amount of overhead is to be expected for
> creating a new thread, but the proportionality with the size of cel
> array makes no sense to me.
I don't understand where you see anything proportionnal to the cel
array. Without forced GC the memory increase generated by the loop is
almost the same (47-29 = 18, 253-234 = 19). The base memory (29kB
versus 234kB) is the memory used by the cel array. If it's not being
used in the loop doesn't mean it's collectable, so it stays there for
the whole execution of the program.