lua-users home
lua-l archive

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


Perhaps I am doing lots of crazy stuff, but my game doubles its memory
usage after somebody using it for a while. I am using standard Lua 4.0
and forcing garbage collection every 5 seconds or so.

But If I force gabarge collection every frame, the game slows down quite 
a bit, but then memory seems not growing too out of control.

I am unable to detect serious memory leaks using dmalloc, so it leads
to think of defragmentation. Then I checked the memory usage using
mallinfo(), it shows:

$1 = {arena = 28611460, ordblks = 10885, smblks = 26349, hblks = 17, hblkhd = 7225344, 
  usmblks = 37208964, fsmblks = 939616, uordblks = 13484524, fordblks = 15126936, keepcost = 880}

So arena - uordblks = 15126936, roughly 15M(!) fragmented mallocs!

Is this considered ordinary? How do I avoid lots of fragmentations? My
game is using lua scripts extensively, including many non-permanent
small string, small table and closure creation in every frame cycle.

Regards,
.paul.