lua-users home
lua-l archive

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

> Did you run the collect cycle _twice_, when trying it?
> See the Lua reference, part of the releases only happen after the second gc 
> call.
> Jens Andersson kirjoitti 25.2.2008 kello 18:27:
>> Thanks for all the good suggestions about this problem. Writing a simple
>> allocator like suggested seems like a decent solution. I did try another
>> approach first though: I remade my program so that there is a specific 
>> point
>> during execution where I can free all dynamic allocations. After
>> implementing that I still had fragmentation issues, so after logging all
>> remaining allocations between two runs a bunch of LUA allocations showed 
>> up.
>> Since I doubt there are memory leaks in there, I assume that I do 
>> something
>> wrong, but a call to lua_close() should free up all dynamic allocations,
>> shouldn't it? I also tried a lua_gc(L, LUA_GCCOLLECT, 0) call before 
>> closing
>> the state, but that didn't affect anything.

If you call lua_close, Lua should release all dynamic allocations (after
calling all finalizers). You do not need to call lua_gc before closing
the state.

-- Roberto