[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Suggestion to garbage collection in Lua 3.2
- From: erik@... (Erik Hougaard)
- Date: Mon, 26 Oct 1998 15:25:48 +0100
To make Lua even more usable - I'm suggestion this addon to the GC
system:
When creating a user tag (lua_newtag) supply a function (or NULL) with
the tag and then in luaS_free call the function with the pointer to the
userdata. We can then program a C function that will free/close
resources.
In that way we can ensure that the garbage collection will/can clean
whatever memory we have allocated, files we have opened (the iolib could
also use this) resources allocated etc. without having to make sure that
our users remember to call closefile/closedatabase/disconnectserver or
whatever functions we might have in our system.
Any comments?
Erik Hougaard