lua-users home
lua-l archive

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


> You may be creating Lua objects without realizing it (but GC should
> collect these):
> http://lua-users.org/wiki/OptimisingGarbageCollection
>
> By allocating and collecting lots of objects that you may not have meant
> to create, you may be fragmenting the memory as you suggest. You just
> have to keep track of references wrt to objects hanging around that you
> thought should have been deleted.
>
> Weak tables can cause loops where you might not expect them:
> http://lua-users.org/wiki/GarbageCollectingWeakTables

    I guess the real question is what other kinds of wacky things could i be
doing that is forcing these objects to not be GC?  I'll look into the weak
tables issue for now.

    This really is a disturbing problem.  How is this situation i'm now
having easier than any problem i've had with memory leaks with new and
delete?  At least with new and delete there are mature tools like
Boundschecker or even MS's debug CRT.  The Lua GC needs to have built-in
tools for detecting and correcting these problems especially in a debug
mode.  Something as simple as a dump to stderr on lua_close().

    Tom