[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: 5.1 request: reporting external memory usage to Lua (Re: Fix needed in 5.0.2 Makefile)
- From: Jay Carlson <nop@...>
- Date: Fri, 12 Mar 2004 00:06:29 -0500
Luiz Henrique de Figueiredo wrote:
We'll look into this (and other Makefile issues) carefully for Lua 5.1.
Another thing for 5.1:
The C implementation of iostring uses an external buffer, with a pointer
stored in a userdata. The userdata itself is quite small. I would
like to tell the garbage collector that it can recover (say) 5 megabytes
if it claims a particular 5 megabyte iostring instance. Without this,
common code patterns may result in a tiny Lua heap that doesn't know
enough to free the monster external buffers. (I am also adding a manual
f:reset() method to allow users to clean them up by hand, but that's
gross.)
My first thought was to add to the API a way of code adding or
subtracting from the global "amount of memory allocated" number that Lua
holds. If C code added to it, it would be responsible for subtracting
it at gc time.
If I could realloc a userdata, that would work for this case too.
Jay