lua-users home
lua-l archive

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

>  I am facing in fact the same situation than with OpenCV : i would
> like to avoid modifying the C library itself.
> Up the now, i think that the easiest solution (even if not 100%
> perfect) is the proposal of Roberto (ie calling the lua_gc(STEP, x)
> during  picture allocation to 'speedup' the gc).
> At the end, and after reading all your contributions, i think that
> the perfect solution still remains the integration of 2 new actions
> in the lua_gc call, allowing to increase/decrease externally the LUA
> internal memory counter.

With the current incremental garbage collector, the collector is moved
forward by allocations, that is, deltas in 'totalbytes', not by its
absolute value. (The only effect that the absolute value of 'totalbytes'
has on the collector speed is to make the collector slower, increasing
the pause between collection cycles.)

So, to mimic the effect of an external allocation as if it were
internal, lua_gc(STEP, x) seems to be more than enough. I do not
think there is a need for extra API.

-- Roberto