lua-users home
lua-l archive

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


On 10 Apr 2006 19:43:40 -0400
gavin@refinery.com wrote:

> Matrix.new() returns a userdata object. Lua's gc threshold starts out
> around 82k. We are pretty sure that there are no memory leaks on the
> C++ side of things. If g_collectNOW is always true, memory stays at a
> consistent level. If g_collectNOW is always false, memory grows
Lua may not be seeing that the memory usage by the Matrix is high, so
it doesnt see a need to GC.  If I understand how the GC works, it will
keep track of the space taken by Lua objects and cycle when there is a
certain size limit.  Since a userdata object is quite small in Lua, it
oughtta take quite a while before that limit is reached.
If you can manage to allocate the Matrix data inside the userdata, then
Lua may have a better chance of seeing the rapid increase in space.

-- 
Thomas Harning Jr.
Fortune:
Wish and hope succeed in discerning signs of paranormality where reason
and careful scientific procedure fail.
- James E. Alcock, The Skeptical Inquirer, Vol. 12

Attachment: signature.asc
Description: PGP signature