lua-users home
lua-l archive

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


On 16 March 2012 16:53, Dimitris Papavasiliou <dpapavas@gmail.com> wrote:
> So while we're on the subject, and since we can always ask the gc how
> much memory is allocated at a given instance but not where this memory
> is used.  Is there a way of finding out what values are still alive in
> the Lua state, and if possible, why they're still alive?  It's a
> problem I've been having on and off.  Sometimes I see that a whole
> tree of values I expected to get rid off still linger but it's not
> always trivial, tracing why they aren't collected.
>

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.

For example as I mentioned in my email, we have a plugin for Prosody
uses the libraries and dumps the graph to a file. These snapshot files
are just text (each edge and vertex of the graph on a new line) and so
can actually be processed with grep and other tools for querying quite
easily to find large clusters. We also have a basic GUI viewer (not
released) for them that we use to browse the graph as a tree, with
root nodes weighted by the size of the nodes they reference.

Most of the memory consumption we have now is in C libraries (OpenSSL,
LuaSocket, LuaSec) - harder to track down :)

Regards,
Matthew