How to know memory use?

How could I know the memory that my app uses? How could I know if it is in the standard approved by App Store and Play Store?

Thanks a lot,
 

Andrea

Hi Andrea,

The following function can be used to test both Lua and texture memory in 1-second intervals:

[lua]

local function memUsage()

    collectgarbage(“collect”)

    local memUsage_str = string.format( “MEMORY = %.3f KB”, collectgarbage( “count” ) )

    print( memUsage_str, "TEXTURE = "…(system.getInfo(“textureMemoryUsed”)/1048576) )

end

timer.performWithDelay( 1000, memUsage, 0 )

[/lua]

Best regards,

Brent

Thank you a lot Brent! So the number 1048576 should be the maximum textureMemory avalaible using Corona?
 

Thank you a lot Brent! So the number 1048576 should be the maximum textureMemory avalaible using Corona?

Hi Andrea,

The “1048576” is actually just converting the output from the system.getInfo(“textureMemoryUsed”) call from bytes to megabytes in terms of computer memory. 1024 x 1024 = 1048576, so dividing the value by that gives you output in megabytes. The actual texture memory available depends on each device, so there’s no “standard” to measure the values you get before you submit to market.

Hope this helps,

Brent

Hi Andrea,

The following function can be used to test both Lua and texture memory in 1-second intervals:

[lua]

local function memUsage()

    collectgarbage(“collect”)

    local memUsage_str = string.format( “MEMORY = %.3f KB”, collectgarbage( “count” ) )

    print( memUsage_str, "TEXTURE = "…(system.getInfo(“textureMemoryUsed”)/1048576) )

end

timer.performWithDelay( 1000, memUsage, 0 )

[/lua]

Best regards,

Brent

Thank you a lot Brent! So the number 1048576 should be the maximum textureMemory avalaible using Corona?
 

Thank you a lot Brent! So the number 1048576 should be the maximum textureMemory avalaible using Corona?

Hi Andrea,

The “1048576” is actually just converting the output from the system.getInfo(“textureMemoryUsed”) call from bytes to megabytes in terms of computer memory. 1024 x 1024 = 1048576, so dividing the value by that gives you output in megabytes. The actual texture memory available depends on each device, so there’s no “standard” to measure the values you get before you submit to market.

Hope this helps,

Brent