Here is an interesting article concerning crashes due to not dealing with garbage collection:
http://jonbeebe.tumblr.com/post/2090082695/faster-garbage-collection-with-corona
[import]uid: 616 topic_id: 20090 reply_id: 79822[/import]
Here is an interesting article concerning crashes due to not dealing with garbage collection:
http://jonbeebe.tumblr.com/post/2090082695/faster-garbage-collection-with-corona
[import]uid: 616 topic_id: 20090 reply_id: 79822[/import]
@mrgoose, sincerely wonderful blog`s post of @JonathanBebee. Great Reading as well. Thanks for that one too.
PS: Nothing better than good rules for optimization.
Cheers,
Rodrigo. [import]uid: 89165 topic_id: 20090 reply_id: 79872[/import]
I’ve now done a few tests. The versions below are in increasing order of texture memory requirement. All figures are for texture memory. iOS devices are running latest 5.0.1, “ipad” is 1st gen iPad, and “tab” is a Samsung Galaxy Tab 8.9 running Android 3.1.
Version 1
3gs: 89MB, sluggish response but doesn’t exit
ipad: 92MB, runs fine
tab: 97MB, runs fine
Version 2
3gs: 102MB, sluggish response but doesn’t exit
ipad: exits
tab: 110MB, runs fine
Version 3
3gs: exits
ipad: exits
tab: 136MB, runs fine
For my app, the limit for my iOS devices is about 100MB. Although the 3GS runs the app, at 89MB, it is clearly struggling and its response is poor. The Samsung tablet looks great as it is still happy when the others have given up. [import]uid: 29384 topic_id: 20090 reply_id: 80057[/import]
Hi ec2
What about system memory for this texture values ? Did you test it ? [import]uid: 13156 topic_id: 20090 reply_id: 80632[/import]
Hi PiotrT,
For all the versions, the amount of normal memory used is 2MB. I did not change it. [import]uid: 29384 topic_id: 20090 reply_id: 80738[/import]
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 [import]uid: 69481 topic_id: 20090 reply_id: 87074[/import]
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 [import]uid: 52491 topic_id: 20090 reply_id: 87244[/import]
Thanks Peach, I’ll appreciate that. [import]uid: 69481 topic_id: 20090 reply_id: 87255[/import]
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 [import]uid: 129334 topic_id: 20090 reply_id: 98999[/import]
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.
[import]uid: 19626 topic_id: 20090 reply_id: 99006[/import]
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…
[lua]collectgarbage(“count”)[/lua] 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.
[import]uid: 129334 topic_id: 20090 reply_id: 99142[/import]
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. [import]uid: 19626 topic_id: 20090 reply_id: 99238[/import]
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. [import]uid: 7559 topic_id: 20090 reply_id: 99245[/import]
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. [import]uid: 129334 topic_id: 20090 reply_id: 99274[/import]
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.
[import]uid: 19626 topic_id: 20090 reply_id: 99277[/import]
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!”
[import]uid: 129334 topic_id: 20090 reply_id: 99279[/import]
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 [import]uid: 12275 topic_id: 20090 reply_id: 101511[/import]
Hi PiotrT,
when you said “is about max 500.234234” are you refering to system memory?
thanks
Hi PiotrT,
when you said “is about max 500.234234” are you refering to system memory?
thanks