lua-users home
lua-l archive

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


On Mon, Mar 31, 2008 at 9:59 AM, Shmuel Zeigerman <shmuz@actcom.co.il> wrote:
>  This is how my application was doing originally. But unfortunately, Lua
>  tables used as dictionaries won't always reclaim memory when their
>  entries are deleted. After several millions creations and deletions of
>  userdata, this (empty!) table was holding > 100 MBytes of RAM that could
>  not be reclaimed with garbage collector.

was that a table of userdata's? or light userdata? or mabye a full
userdata that holds only a pointer?  in the second or third case, Lua
has no way to know how much RAM your object really holds, maybe from
it's side a couple thousands of pointers is just a few KB's but from C
it's several MB's.

in that case, you should have a 'close' method to release your object
and not rely on __gc(), because it might not occur soon enough.

-- 
Javier