lua-users home
lua-l archive

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


On Thu, Sep 2, 2010 at 4:47 PM, Peter Cawley <lua@corsix.org> wrote:
> My proposal is that the current image-related code is taken, and then
> the calls to malloc/free which deal with the large buffer are replaced
> with calls to some generic allocator. Then the above Lua-based
> allocator is used as the generic allocator, meaning that the garbage
> collector is aware that there is this large block of memory floating
> around. This causes the Lua GC to run collections at better intervals,
> which should cause the proper image userdata to be collected. In turn,
> the __gc method on the proper userdata will eventually call the
> generic free function on its large buffer, which calls the lua
> allocator free function, which causes the large buffer to be garbage
> collected in the next cycle.

Very interesting.  Thanks, that's a consequence I hadn't thought of.