[b42] Memory leak?

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
Grey
Loremaster
Posts: 3517
Joined: Thu Sep 23, 2010 10:18 pm
Location: London, England
Contact:

[b42] Memory leak?

#1 Post by Grey »

I noticed the T-Engine running slow after about 20 hours of straight running (er, yeah, I need sleep now...) Starting up Task Manager I see ToME4 is using over 600k of memory. This was on the world map, so there should be little held in memory. I saved and closed and it was down to 100k with just the T-Engine main menu.

I exited and restarted and it was 60k in the T-Engine menu and 120k in-game on reloading the save. Seems clear there's a memory leak somewhere. It's not terrible - would take a few days to fully crash the game on a modern machine - but still something to be looked at.
http://www.gamesofgrey.com - My own T-Engine games!
Roguelike Radio - A podcast about roguelikes

Grazz
Cornac
Posts: 30
Joined: Thu Nov 24, 2011 8:57 pm

Re: [b42] Memory leak?

#2 Post by Grazz »

By 600k are you meaning 600m? Sounded crazy low for me so I just launched T-Engine with a module in text based display and it shot up to 41m immediately.

Grazz

aardvark
Wyrmic
Posts: 200
Joined: Wed Aug 22, 2012 12:16 am

Re: [b42] Memory leak?

#3 Post by aardvark »

Depending on how much RAM is installed in your system, it's possible that Lua's garbage collection never ran. I don't know what algorithm Lua uses, but some garbage collectors don't run until they hit some high water mark. If Lua uses one of those algorithms and you have plenty of free memory left, it may never happen.

Grey
Loremaster
Posts: 3517
Joined: Thu Sep 23, 2010 10:18 pm
Location: London, England
Contact:

Re: [b42] Memory leak?

#4 Post by Grey »

Grazz wrote:By 600k are you meaning 600m? Sounded crazy low for me so I just launched T-Engine with a module in text based display and it shot up to 41m immediately.

Grazz
Oh, yeah, 600m :/ My brain is still stuck in the day of using a computer with 512k RAM ;)
http://www.gamesofgrey.com - My own T-Engine games!
Roguelike Radio - A podcast about roguelikes

tiger_eye
Perspiring Physicist
Posts: 889
Joined: Thu Feb 17, 2011 5:20 am

Re: [b42] Memory leak?

#5 Post by tiger_eye »

aardvark wrote:I don't know what algorithm Lua uses, but some garbage collectors don't run until they hit some high water mark.
Since you brought it up, you may enjoy this article:

http://wiki.luajit.org/New-Garbage-Collector

Oh, and I think T-Engine collects garbage in Lua whenever the game gets saved (in addition to the automatic GC sweeps).
darkgod wrote:OMFG tiger eye you are my hero!

Post Reply