Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Acceptable Memory Usage?
Started by mrgoose Jan 07 2012 05:33 PM

- - - - -
37 replies to this topic
[TOPIC CONTROLS]
Page 2 of 2 1 2
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#26

sheraz.jamshed

[GLOBAL: userInfoPane.html]
sheraz.jamshed
  • Observer

  • 16 posts
  • Corona SDK

Hi Peach

Can Instruments tool be used to check memory consumption of an app developed in CORONA ?

Strangely, the collectgarbage("count")& system.getInfo( "textureMemoryUsed" values I print and get to see in console is much much lower then the one shown by instruments. So I am not sure which ones are the true values. Please help!

cheers,
Sheraz
uid: 69481 topic_id: 20090 reply_id: 87074


[TOPIC: post.html]
#27

peach pellen

[GLOBAL: userInfoPane.html]
peach pellen
  • Corona Geek

  • 8,866 posts
  • Alumni

Hi Sheraz,

I have not used Instruments myself and would think it would be accurate; however the print function used above in post #14 has always seemed fairly spot on to me. (For example I know certain devices start showing a little lag at 25MB texture memory, I have ran an app at 24MB and again at 26MB, as reported by function above and noticed the little lag appearing.)

That said, I will try to look at Instruments this week and see what I can find out.

Peach :)
uid: 52491 topic_id: 20090 reply_id: 87244


[TOPIC: post.html]
#28

sheraz.jamshed

[GLOBAL: userInfoPane.html]
sheraz.jamshed
  • Observer

  • 16 posts
  • Corona SDK

Thanks Peach, I'll appreciate that.
uid: 69481 topic_id: 20090 reply_id: 87255


[TOPIC: post.html]
#29

Mark A

[GLOBAL: userInfoPane.html]
Mark A
  • Enthusiast

  • 50 posts
  • Corona SDK

Hi All, this is a great post / replies and I have a question that I may have missed?

What is the acceptable LUA Memory value?
I know it depends, but what's a good target value to start with (I mean stay under), for let's say for 3GS?

I am using:
collectgarbage("count")
from Jonathan Beebe's memory leak prevention 101:
http://blog.anscamobile.com/2011/08/corona-sdk-memory-leak-prevention-101/

Also, is the LUA memory piece of code that I just posted, in MB???

(not to get confused with Texture Memory)

Thanks
uid: 129334 topic_id: 20090 reply_id: 98999


[TOPIC: post.html]
#30

Omnigeek Media

[GLOBAL: userInfoPane.html]
Omnigeek Media
  • Corona Geek

  • 2,975 posts
  • Corona SDK

Just as a trivial-being-a-nerd-point. For the texture memory you should be dividing by 1048576 instead of 1000000. That's / (1024 * 1024).

As for memory usage, I go by a simple rule of thumb:

1/2 the available RAM on the device.

Of course, sometimes you won't get all that, sometimes you will get more. It depends on what all is running and isn't "swapped" out. It's an unpredictable target.

Since the oldest devices we are probably going to support have 256M of memory, I'm comfortable using 128M... But I've seen memory warnings as low as 32M on my iPhone4.
uid: 19626 topic_id: 20090 reply_id: 99006


[TOPIC: post.html]
#31

Mark A

[GLOBAL: userInfoPane.html]
Mark A
  • Enthusiast

  • 50 posts
  • Corona SDK

Hi, robmiracle, thanks for the info! With that said, I have a very "noob" type question, and has to do with conversion for the LUA Memory being displayed.....

collectgarbage("count")
outputs the KB, so 1,000 KB = 1 MB. Correct?

Right now my first level outputs around 500 KB, so I'm wayyy under (which is a good thing), correct?

If I've offended anyone with this simple question, my apologies.
uid: 129334 topic_id: 20090 reply_id: 99142


[TOPIC: post.html]
#32

Omnigeek Media

[GLOBAL: userInfoPane.html]
Omnigeek Media
  • Corona Geek

  • 2,975 posts
  • Corona SDK

Well 1MB = 1024KB and yes, the Lua memory reports in KB.

But that's only one type of memory. There is also Texture memory which is misleading as I think it also is memory used by audio too (not 100% sure on that one). All of your display objects (images, spites,etc) are in a different pool of memory and that typically runs in the megabytes of memory.

So while 500kb of Lua memory is well under anything scary, you have to count both chunks of memory. FWIW, 500kb of Lua memory seems like a lot. That's all your local variables, tables and strings. But I don't know how data intense your app is.
uid: 19626 topic_id: 20090 reply_id: 99238


[TOPIC: post.html]
#33

Tom

[GLOBAL: userInfoPane.html]
Tom
  • Moderator

  • 1,480 posts
  • Corona Staff

Texture memory is the memory used by openGL for graphics. GC count is the memory used for Lua variables. There are other memory objects (e.g. Audio buffers) that can't be measured inside Corona. Instruments (Mac) is a good tool to check on overall memory usage of your app. Even if you are developing an Androd-only app, and you have a Mac, I would give Instruments a try.
uid: 7559 topic_id: 20090 reply_id: 99245


[TOPIC: post.html]
#34

Mark A

[GLOBAL: userInfoPane.html]
Mark A
  • Enthusiast

  • 50 posts
  • Corona SDK

robmiracle, you said 500kb of LUA memory is well under anything scary, but in the next line you say that 500kb of LUA memory seems like a lot...? Should I re-examine my local variables, tables and strings and try to get under 500kb of LUA memory?

Regarding Texture Memory, yes, I am aware of it and know it's different than LUA Memory.

According to the posts here, from what I read, ec2 did some tests on texture memory vs. the performance of a few devices. What was found was on 3gs, 89MB of Texture Memory made it sluggish (post#22). Also Peach mentioned that she's experienced a lag in some devices, with just 25mb of tetxure memory (post#26).

Tom, thanks for the info. By Mac instruments, I'm guessing Xcode tools, correct?

Thanks.
uid: 129334 topic_id: 20090 reply_id: 99274


[TOPIC: post.html]
#35

Omnigeek Media

[GLOBAL: userInfoPane.html]
Omnigeek Media
  • Corona Geek

  • 2,975 posts
  • Corona SDK

I knew when I wrote that it wouldn't make a lot of sense, so let me try a take 2 on it.

Let's say that your total memory for your app is 50mb. Your Lua memory at 0.5mb (1% of the total) isn't much in the grand scheme of things.

But, 500kb (or 0.5mb) is a lot of tables, strings and simple variables.

Lets put it this way, that's the same as 6,400 80 character strings.

Since that's a lot when you consider what is included, I might be concerned that you're not nil'ing out freeded up items or something is chewing through your lua memory.

Now if your app has a lot of data it may not be a big deal.

uid: 19626 topic_id: 20090 reply_id: 99277


[TOPIC: post.html]
#36

Mark A

[GLOBAL: userInfoPane.html]
Mark A
  • Enthusiast

  • 50 posts
  • Corona SDK

got it. Thanks, and you are probably right about the nil'ing out, if only there was a huge sign that said "Here's all your items, and here's all that are nil'ed!"
uid: 129334 topic_id: 20090 reply_id: 99279


[TOPIC: post.html]
#37

leonardoaguilar

[GLOBAL: userInfoPane.html]
leonardoaguilar
  • Observer

  • 8 posts
  • Corona SDK

I dont understand. I have an simple app have 10 graphics optimizaed with photoshop. My texture is 20 but when the memory id 25 the iphone 4 slow the game.

I use correctly storyboard to crea and remove all images , listeners and all.

I dont understad who i can create a game with this low memory.
Any suggestion?

thanks

Best regards
Leonardo
IvalueLabs
uid: 12275 topic_id: 20090 reply_id: 101511


[TOPIC: post.html]
#38

luisxpto32

[GLOBAL: userInfoPane.html]
luisxpto32
  • Observer

  • 16 posts
  • Corona SDK

My game is working perfectly fine (iPhone4) when memory usage is about max 500.234234 but when memory usage is about 550 and higher the game slows down ???
Texture Memory is about plus minus 10-14 MB
Is it normal ?

but maybe is TextureMemory problem ??

uid: 13156 topic_id: 20090 reply_id: 78484

 

Hi PiotrT,

when you said "is about max 500.234234" are you refering to system memory?

 

thanks




[topic_controls]
Page 2 of 2 1 2
 
[/topic_controls]