[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Ever-Increasing Memory Usage in 5.0
- From: Daniel Silverstone <dsilvers@...>
- Date: Tue, 11 Apr 2006 10:47:05 +0100
On Mon, 2006-04-10 at 23:07 -0600, Gavin Kistner wrote:
> 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.
My guess is that you're boxing the matrix pointer in a userdata, and as
such, your userdata is four bytes big. This is all Lua takes into
account so I'm guessing your sawtooth will be present, just incredibly
large.
> 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?
Simple memory fragmentation at a guess. At points less regularly than
once per frame you are allocating an object which is longer lived than
the per-frame objects.
When I last worked on a game engine, we would force a garbage-collect
once per second which was less irritating than every frame but often
enough to keep memory use down. But we weren't using Lua so I don't know
how Lua would behave in this instance.
Remember that as Thomas said, the size of the userdata from the point of
view of the garbage collector is the number of bytes you allocated (4 or
8 for a boxed pointer) and the size of the Udata header which is
probably somewhere in the region of 16 or 20 bytes on most common 32bit
architectures.
Regards,
Daniel
--
Daniel Silverstone http://www.digital-scurf.org/
PGP mail accepted and encouraged. Key Id: 2BC8 4016 2068 7895