_T = display.screenOriginY
_CX = display.contentCenterX
local function getMemoryUsage()
local memUsed = (collectgarbage(“count”))
local texUsed = system.getInfo( “textureMemoryUsed” ) / 1048576 – Reported in Bytes
return “system:” … string.format("%.00f", memUsed) … “KB” … " texture:"… string.format("%.03f", texUsed) … “MB”
end
local memoryUsageText
local function monitorMem()
local memUsed = (collectgarbage(“count”))
local texUsed = system.getInfo( “textureMemoryUsed” ) / 1048576 – Reported in Bytes
memoryUsageText.text = string.format("%.00f", memUsed) … “KB” … " texture:"… string.format("%.03f", texUsed) … “MB”
end
if memoryUsageText == nil then
memoryUsageText = display.newText(getMemoryUsage(), _CX - 50, _T + 20, native.systemoFont, 64 )
memoryUsageText.alpha = .5
--memoryUsageText:setFillColor( uHexColor("#ff0000aa"))
Runtime:addEventListener( “enterFrame”, monitorMem )
end
local cnt = 1
local function myListener()
local baseDir = system.DocumentsDirectory
local capture = display.captureScreen()
display.save( capture, cnt … “.png”, baseDir )
local imageOutline = graphics.newOutline( 2, cnt … “.png”, baseDir )
capture:removeSelf()
cnt = cnt + 1
end
Runtime:addEventListener( “touch”, myListener )
When touching the screen, texture memory will keep increasing.