Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

How to know memory use?
Started by Andrea Zanetti Apr 23 2013 07:06 AM

4 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Andrea Zanetti

[GLOBAL: userInfoPane.html]
Andrea Zanetti
  • Enthusiast

  • 54 posts
  • Corona SDK

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



[TOPIC: post.html]
#2

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

Hi Andrea,

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

 

 
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 )
 
Best regards,
Brent

 

 



[TOPIC: post.html]
#3

Andrea Zanetti

[GLOBAL: userInfoPane.html]
Andrea Zanetti
  • Enthusiast

  • 54 posts
  • Corona SDK

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



[TOPIC: post.html]
#4

Andrea Zanetti

[GLOBAL: userInfoPane.html]
Andrea Zanetti
  • Enthusiast

  • 54 posts
  • Corona SDK

Hi Andrea,

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

 

 
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 )
 
Best regards,
Brent

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



[TOPIC: post.html]
#5

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

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




[topic_controls]
 
[/topic_controls]