[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Incremental GC, step multiplier and finalizers
- From: Jean-Luc Jumpertz <jean-luc@...>
- Date: Fri, 1 Nov 2013 12:50:15 +0100
Le 1 nov. 2013 à 11:58, Roberto Ierusalimschy <roberto@inf.puc-rio.br> a écrit :
> 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.)
Unfortunately I can't use this approach because I have no way of knowing the actual size of memory allocated for an external object, as the types of the external objects are mostly opaque for the bridging code.
And anyway, calling lua_gc(L, LUA_GCSTEP, n) has the disadvantage of forcing the exit of the gc-paused state (as it calls luaC_forcestep, and not luaC_checkGC), so calling it every time a userdata is created would practically mean that the GC would never be paused in this configuration, which would have an impact on performances, if my understanding is correct.
Jean-Luc