I’d like to check how much memory use my newRects. When I type
system.getInfo("textureMemoryUsed")
it prints me 0. How check the all of memory used by my app?
I’d like to check how much memory use my newRects. When I type
system.getInfo("textureMemoryUsed")
it prints me 0. How check the all of memory used by my app?
\_debug.showMem = true if \_debug.showMem == true then local showMemUsage = display.newText( "", 0, 0, 0, 300, native.systemFont, 10 ) showMemUsage:setReferencePoint( display.BottomLeftReferencePoint ) showMemUsage.rotation = 90 showMemUsage.y = ((display.viewableContentHeight + -1\* display.screenOriginY) / 2) showMemUsage.x = 0 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 Tex:" .. math.floor(textMem\*1000)\*0.001 .. "MB") showMemUsage.text = "Mem:" .. math.floor(sysMem\*1000)\*0.001 .. "MB Tex:" .. math.floor(textMem\*1000)\*0.001 .. "MB" end end) end
Can put this in your main.lua to show memory. I got it from somewhere. Its CPU intensive so disable when not using…
\_debug.showMem = true if \_debug.showMem == true then local showMemUsage = display.newText( "", 0, 0, 0, 300, native.systemFont, 10 ) showMemUsage:setReferencePoint( display.BottomLeftReferencePoint ) showMemUsage.rotation = 90 showMemUsage.y = ((display.viewableContentHeight + -1\* display.screenOriginY) / 2) showMemUsage.x = 0 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 Tex:" .. math.floor(textMem\*1000)\*0.001 .. "MB") showMemUsage.text = "Mem:" .. math.floor(sysMem\*1000)\*0.001 .. "MB Tex:" .. math.floor(textMem\*1000)\*0.001 .. "MB" end end) end
Can put this in your main.lua to show memory. I got it from somewhere. Its CPU intensive so disable when not using…