lua-users home
lua-l archive

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

Thanks everybody for your replies...

As there are, as far as I know, no memory leaks in Lua, I would look
at your memory manager for leaks.

I agree with Edgar on the "no memory leaks in Lua" part.  Here are
just some random remarks, based on your observations:

This is good to know. I was also refering to "soft" leaks like when symbols don't get collected for whatever reason.

1.  It can take two subsequent gc cycles to collect everything.  This
one is easy to check by doing a double gc when you start/quit your

I wondered about this. We have put in 2 gcs and will see if the behaivor changes.

2.  If you have a stable life time cycle of objects, then Lua should
*not* report "a few KB" increase between runs (I gather your obtain
this via gcinfo), it should report the exact same amount.  The GC in
Lua 5.0 runs atomically and is completely deterministic.  Realloc-ing
to 0 (zero) as Edgar suggested cannot cause this increase.

I thought so too. Good to know it shouldn't.

4.  There *is* a way to create uncollectable cycles in Lua: if (k, v)
is a key value pair in a weak valued table and v refers (directly or
indirectly) back to k then that pair will never be removed from the
table, even if v is the *only* reference to k.
Correction: this holds for *weak keyed tables* and not (as stated) for
*weak valued tables*.

This is interesting. Is this the _only_ way to create uncollectable items? Are there others?