lua-users home
lua-l archive

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


Have you looked to see if the number of Lua owned blocks is going up during
execution?  In debug mode lua keeps a count and mem size (see lmem.h):
#ifdef LUA_DEBUG
extern unsigned long memdebug_numblocks;
extern unsigned long memdebug_total;
extern unsigned long memdebug_maxmem;
extern unsigned long memdebug_memlimit;
#endif

Probably there are references accumulating that lua doesn't think it can
release and it just has to traverse them all.  Why they are accumulating is
the real question but my crystal ball is not working right now.  ;->

Russ

> From: "Martin Stone" <Martin.Stone@creations-group.com>
> Reply-To: lua-l@tecgraf.puc-rio.br
> Date: Tue, 5 Feb 2002 16:53:54 -0000
> To: Multiple recipients of list <lua-l@tecgraf.puc-rio.br>
> Subject: Garbage collection slowdown
> 
> Hello everyone.  I wonder if anyone can help me...
> 
> I'm repeatedly forcing garbage collection every frame (in a game) like this:
> 
> lua_setgcthreshold(L, 0);
> 
> The time taken for this function to complete seems to increase with each call.
> In between calls the same lua function is called every frame, generating
> (presumably) a fixed amount of garbage each time.
> 
> Does anyone know what I can do about this?
> 
> Thanks,
> 
> Martin.
> 
>