lua-users home
lua-l archive

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


Hello,

How does one track memory leaks in a Lua application?

In the case of my application (a Web server), looking at external indicators (e.g. top), all the signals are red. The memory allocation seems to go only one way: up. Ditto for gcinfo() & collectgarbage().

The numbers consistently increase by around 50 KB per request. The application starts at around 319KB and from then on goes up and up and up, by neat 50KB chunks.

This is most likely self inflicted pain (ie my own bug), but before I start tearing everything apart, any tricks & hints on how to track memory leaks in the context of a Lua application?

In this specific case, the code base is mostly Lua scripts. The only native libraries, beside the Lua VM itself, are lsocket, lfs and zlib.

For the record I'm using Lua 5.1 (work5) on Mac OS X 10.3.8. gcc reports the following:

Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
Thread model: posix
gcc version 3.3 20030304 (Apple Computer, Inc. build 1666)

Thanks for any insights :)

Cheers

--
PA, Onnay Equitursay
http://alt.textdrive.com/