lua-users home
lua-l archive

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


On Tue, May 5, 2009 at 10:27 AM, Gergely BOROMISSZA
<Gergely.BOROMISSZA@navngo.com> wrote:
> I've already read the manual but my __gc function was only called when I quit the program or when I call collectgarbage manually. So there was a plenty waste of memory which was not freed.

what happened was probably that the GC didn't see any need to collect.

Lua only keeps track of the memory used inside Lua.  if your userdata
holds only a pointer, or a small structure with references to bigger
objects, that would be the only size that Lua knows about.

to get better results either put most of your object's data inside the
userdata, or add some close() method that releases any resource
external to Lua.

-- 
Javier