lua-users home
lua-l archive

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


On 16 March 2012 18:26, Dimitris Papavasiliou <dpapavas@gmail.com> wrote:
>> That's exactly what we use the libraries I posted for. Granted, it's
>> not a complete solution on its own, but it's usable and could be made
>> into one.
>
> I gathered as much by looking at the code.  I was too lazy to figure
> out myself though whether something like that can be done reliably
> outside of Lua (I mean outside of the interpreter itself).  I suppose
> the authoritative source for this kind of information is the GC so I
> was hoping that there might be a way to query it that I was missing.
> >From your experience in implementing this traversal module, is it
> possible to make sure that you've reached all live objects inside the
> state?
>

I've never done a comparison vs how many objects Lua thinks it has
allocated, but the sum of the object sizes in a snapshot is
reassuringly close to the value reported by collectgarbage("count")
(it often differs a little, but collectgarbage()'s value includes
objects that are not reachable but haven't been swept yet).

So I'm fairly sure, but I would love to do further testing confirming
it (not hard, just haven't had time or enough motivation). To put it
another way though, we have had no, er, hoards, in Prosody that we
haven't been able to solve with this technique, so it's definitely
accurate enough and serves its purpose.

Regards,
Matthew