lua-users home
lua-l archive

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


It seems to be a good start.
What bothers me is the condition to decide what can be collected or not.
If your code just allocates chunks, perform a local work with it and
then free it, alloca function could also work, at a much lower cost...
If, as I imagine, a chunk must be kept until some other other chunk is
used, it becomes more complicated. You will need to keep references in
Lua (for example with a table in the registry, where the keys are
lightuserdata) in the some way as in C++ the destructors are usually
chained. This can not be done be simply changing calloc in your
library.