lua-users home
lua-l archive

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


> Finally I have found a (hopfully) good solution for my GC and
> finalizers issue:  It consists in speeding up the GC cycle
> transparently for the user by running GC steps in the background when
> the host application is idle, as long as an active (i.e. not paused)
> GC cycle is on-going.

Can you try this alternative approach? Every time you create in Lua a
userdata with external memory, call lua_gc(L, LUA_GCSTEP, n), where 'n'
is the amount (in Kbytes) of external memory. That way, you also speed
up the collector, but more in tandem with memory consumption.  (This
call will closely match what Lua would do if the userdata itself was
that big.)

-- Roberto