lua-users home
lua-l archive

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

On Tue, Jul 15, 2008 at 11:23:16AM -0700, Chip Salzenberg wrote:

I've go a weirdness with GC that I'm having a bit of difficulting tracking
down.  The xstring module comes with two programs that, from a structural
POV, do the same thing: create a Lua state, load a Lua file that defines a
function, create some xstrings, and pass the xstrings to the Lua function.

Here's the weirdness: the testxs program's xstrings get their __gc functions
called, so it has no memory leaks; but the xsperf program's xstrings do
*not* get their __gc functions called, so it *does* have memory leaks.  Note
that I'm calling lua_close() in both cases, so in both cases all extant
userdata should *eventually* be finalized.  But in one case, it isn't.

Even speculation would be welcome (though reading the code too would be nice
:-)); what could I doing differently such that I could interfere with GC at

PS: xsperf has a couple of memory leaks unrelated to GC that I've fixed in
    my working copy; the mystery at this point is all about __gc.
Chip Salzenberg <>