Best tool for memory usage

I am currently using this code to keep a tab on my memory usage, but was wondering if this is the best way (since I’ve stumbled upon some other ways, but not sure)… here’s where I got my memory mangement code:
http:</http:>

and it looks like this:

[code]local monitorMem = function()

collectgarbage()
print( "MemUsage: " … collectgarbage(“count”) )

local textMem = system.getInfo( “textureMemoryUsed” ) / 1000000
print( "TexMem: " … textMem )
end

Runtime:addEventListener( “enterFrame”, monitorMem )[/code]

I’ve actually modified the code to round up (to avoid all the extra numbers) and also made it show up in a text box on my screen.

Any thoughts or suggestions? [import]uid: 129334 topic_id: 24223 reply_id: 324223[/import]

I think this is a good tool… [import]uid: 129334 topic_id: 24223 reply_id: 98455[/import]

I use this a lot modify it as you want.

[code]

–MEMORY USAGE DISPLAY

local lastCheck = {sysMem = 0, textMem = 0}
Runtime:addEventListener(‘enterFrame’, function()
– watch for leaks
collectgarbage()

local sysMem = collectgarbage(“count”) * 0.001
local textMem = system.getInfo( “textureMemoryUsed” )*0.000001

if lastCheck.sysMem ~= sysMem or lastCheck.textMem ~= textMem then
lastCheck.sysMem = sysMem
lastCheck.textMem = textMem

print ("mem: " … math.floor(sysMem*1000)*0.001 … "MB \t " … math.floor(textMem*1000)*0.001 … “MB”)
end
end)
local fps = require(“fps”)
local performance = fps.PerformanceOutput.new();
performance.group.x, performance.group.y = _W/2, _H/2 +400;
performance.alpha = 1; – So it doesn’t get in the way of the rest of the scene

[/code] [import]uid: 61600 topic_id: 24223 reply_id: 99657[/import]