lua-users home
lua-l archive

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


On Apr 10, 2006, at 6:56 PM, Thomas Harning Jr. wrote:
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.

I'm unsure where the Matrix data is allocated, so thanks for these thoughts. It very well may be that the Lua side of the memory growth is quite tiny. (I'm just the humble scripter, not the engineer who works on the integration.) I will run a test tomorrow and let it run a very long time. However, my hunch is that it will not suddenly hit a GC point and collect, but will interminably grow.

In either case, this doesn't explain the results I'm seeing with the increasing 'plateaus' which GC brings mem usage down to. Any thoughts on that?