Created
November 19, 2012 17:09
-
-
Save cspencegists/4111969 to your computer and use it in GitHub Desktop.
Corona SDK: Monitor Memory Usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- @DEBUG monitor Memory Usage | |
local printMemUsage = function() | |
local memUsed = (collectgarbage("count")) | |
local texUsed = system.getInfo( "textureMemoryUsed" ) / 1048576 -- Reported in Bytes | |
print("\n---------MEMORY USAGE INFORMATION---------") | |
print("System Memory: ", string.format("%.00f", memUsed), "KB") | |
print("Texture Memory:", string.format("%.03f", texUsed), "MB") | |
print("------------------------------------------\n") | |
end | |
-- Only load memory monitor if running in simulator | |
if (system.getInfo("environment") == "simulator") then | |
Runtime:addEventListener( "enterFrame", printMemUsage) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment