lua-users home
lua-l archive

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

On 6/27/07, Jose Luis Hidalgo <> wrote:
Hi Fabien,

Just in case, how do you check your leaking problems?

I'm embedding a shell on a small device, and each time I create, close and dereference some userdata encapsulating a communication channel, the amount of memory used by Lua increases. Checked on my custom memory allocator as well as through the gc Lua API.  (Of course I make several full GC cycles before checking).

The tool provided by Alexandra through Roberto seems very cool, but it crashes for me due to the limited amount of free RAM I have. By putting breakpoints on the GC, I just saw that the userdata is kept referenced from a thread's stack. I don't know yet which thread, nor how it got this reference, nor if a single thread is responsible for keeping all userdata alive.

As for the memleak tool: if it works as well as it seems, it would be worth putting it (or a C reimplementation) it in the distribution: despite marketing hype about "GC makes memory handling easy", it's still fairly easy and common to leak memory, and fixing it is tricky.