lua-users home
lua-l archive

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


> If you know how much allocated data there is, and you know that collection
> will not be delayed (e.g. because of __gc finalizers), then you have a
> known upper bound on mark&sweep time.

This. It's easy to keep count on allocated memory, just pass a
counting wrapper to
http://www.lua.org/manual/5.1/manual.html#lua_setallocf

And mark&sweed collectors add just a constant to the mem amount, so
you actually CAN define bounds.

Hope that helps,
Martin

On 27 October 2010 04:10, Juris Kalnins <juris@mt.lv> wrote:
> On Wed, 27 Oct 2010 11:58:16 +0300, Rob Kendrick <rjek@rjek.com> wrote:
>
>> On Wed, Oct 27, 2010 at 08:39:58AM +0300, Juris Kalnins wrote:
>>
>>> If the script is short lived, and turning GC completely off is
>>> an acceptable option, it's the most predictable way. It is possible then
>>> to
>>> run full GC manually at known times.
>>
>> How is it possible to know how long the GC will take, even if you run it
>> at known times?
>
> If you know how much allocated data there is, and you know that collection
> will not be delayed (e.g. because of __gc finalizers), then you have a
> known upper bound on mark&sweep time.
>
>