What are some general guidelines for how much system memory and texture memory it is “safe” to have a game use? Basically, I want to make sure I’m avoiding crashing, slow performance, and memory warnings. What are the thresholds, generally? [import]uid: 135391 topic_id: 34726 reply_id: 334726[/import]
That’s really tough to answer because a lot depends on the device that you plan to run on. On the iOS side, the worst case that you’re going to build for is the iPhone 3Gs or the iPad 1. It has a limit of 256 megabytes of memory and doesn’t have the quickest CPU. Some Android devices may be a little worse off.
I don’t know how much free memory you really have, but I’ve found that my apps start struggling around 120M of texture memory, which is roughly half of what’s available on the iPad1/iPhone 3Gs.
Corona’s system memory is generally less than one image background. I generally don’t worry too much about non-texture memory other than making sure I’m not leaking memory.
It’s not a definitive answer, but its a start. [import]uid: 199310 topic_id: 34726 reply_id: 137977[/import]
Thanks, Rob. I’m using Level Helper along with Corona, and Level Helper seems to be a Lua system memory hog (10-12MB system memory with large levels). But it sounds like that’s not that big of a deal?
When computing whether to give a memory warning, is the iOS device basically just adding up both system and texture memory use together to determine wether the app’s overall memory usage is a problem? If that’s the case, then if my large levels are using 10MB of system memory and 200 MB of texture memory, the texture memory is what I should be worrying about, mostly. Sound right? [import]uid: 135391 topic_id: 34726 reply_id: 137983[/import]
As Rob said, general guidelines are tough with so many various devices still in use. The obvious concern is on older devices with slower hardware and less memory.
I believe Rob said elsewhere to stay within half the memory of the device. That is a good general guideline. However you mention low memory warnings. That is probably almost impossible to not hit on an older iOS device. Example: iPad 1 with 256mb of memory. My app which at it’s peak hits 40mb usually gets low memory warnings as soon as I load it up. I think the only other apps open are testflights app and Safari. Now I am sure Safari takes a bit of memory depending on the web pages loaded. Just handle the notification, free what memory you can. It all works out. Never had a crash or closing from memory yet in my testing. As Rob mentioned he has went up to 120MB.
System memory I am unsure about. I read in one of the posts that 500k is pretty high (that may of been Rob again), however that depends I think on what modules that are being used. I have all the Candy products from x-pressive. Loading just one of those tends to push my app close to 500k. Since I use all 3 in my current app. Between them and my horribly bad habit of using globals, it reaches about 2MB of system memory. Letting the garbage collector handle itself my app was at one point hitting 6MB. I tweaked the garbage collector to clear more often (it was clearing every 25-30 seconds). Now it’s steady at 2MB. Particle candy can create and destroy a lot of objects in a short amount of time and the garbage collector wasn’t keeping up.
That’s just my observations from experience and I am not sure how much that helps with answering the questions.
Biggest guideline I can give is test, test, test and get testers with devices that concern you.
[import]uid: 56820 topic_id: 34726 reply_id: 137985[/import]
Thanks, anderoth. Using Level Helper, I’m hitting 10+MB of system memory usage on some of my game levels. Seems like a lot to me. But if system memory isn’t independently important outside of my total memory usage (system + texture), maybe I shouldn’t worry too much about it. [import]uid: 135391 topic_id: 34726 reply_id: 137988[/import]
I am not sure what system memory will really effect.
After my game runs a couple days, playing multiple multiplayer games, it gets a hiccup every 20-30 seconds. I went in search of a memory leak and simply found that all the particles where increasing memory by 2-3MB and then after 20-30 seconds it would clear that 2-3MB all at once. I am not 100% sure if that was my culprit for the pausing. I only recently made the change. But that was the reason for me tweaking the garbage collector timing. I have no memory leak. I hope that solves my issue.
However as you say, concerning memory, I would think it’s simply a matter of system memory + texture memory fitting into available memory and your all good. [import]uid: 56820 topic_id: 34726 reply_id: 137992[/import]
That’s really tough to answer because a lot depends on the device that you plan to run on. On the iOS side, the worst case that you’re going to build for is the iPhone 3Gs or the iPad 1. It has a limit of 256 megabytes of memory and doesn’t have the quickest CPU. Some Android devices may be a little worse off.
I don’t know how much free memory you really have, but I’ve found that my apps start struggling around 120M of texture memory, which is roughly half of what’s available on the iPad1/iPhone 3Gs.
Corona’s system memory is generally less than one image background. I generally don’t worry too much about non-texture memory other than making sure I’m not leaking memory.
It’s not a definitive answer, but its a start. [import]uid: 199310 topic_id: 34726 reply_id: 137977[/import]
Thanks, Rob. I’m using Level Helper along with Corona, and Level Helper seems to be a Lua system memory hog (10-12MB system memory with large levels). But it sounds like that’s not that big of a deal?
When computing whether to give a memory warning, is the iOS device basically just adding up both system and texture memory use together to determine wether the app’s overall memory usage is a problem? If that’s the case, then if my large levels are using 10MB of system memory and 200 MB of texture memory, the texture memory is what I should be worrying about, mostly. Sound right? [import]uid: 135391 topic_id: 34726 reply_id: 137983[/import]
As Rob said, general guidelines are tough with so many various devices still in use. The obvious concern is on older devices with slower hardware and less memory.
I believe Rob said elsewhere to stay within half the memory of the device. That is a good general guideline. However you mention low memory warnings. That is probably almost impossible to not hit on an older iOS device. Example: iPad 1 with 256mb of memory. My app which at it’s peak hits 40mb usually gets low memory warnings as soon as I load it up. I think the only other apps open are testflights app and Safari. Now I am sure Safari takes a bit of memory depending on the web pages loaded. Just handle the notification, free what memory you can. It all works out. Never had a crash or closing from memory yet in my testing. As Rob mentioned he has went up to 120MB.
System memory I am unsure about. I read in one of the posts that 500k is pretty high (that may of been Rob again), however that depends I think on what modules that are being used. I have all the Candy products from x-pressive. Loading just one of those tends to push my app close to 500k. Since I use all 3 in my current app. Between them and my horribly bad habit of using globals, it reaches about 2MB of system memory. Letting the garbage collector handle itself my app was at one point hitting 6MB. I tweaked the garbage collector to clear more often (it was clearing every 25-30 seconds). Now it’s steady at 2MB. Particle candy can create and destroy a lot of objects in a short amount of time and the garbage collector wasn’t keeping up.
That’s just my observations from experience and I am not sure how much that helps with answering the questions.
Biggest guideline I can give is test, test, test and get testers with devices that concern you.
[import]uid: 56820 topic_id: 34726 reply_id: 137985[/import]
Thanks, anderoth. Using Level Helper, I’m hitting 10+MB of system memory usage on some of my game levels. Seems like a lot to me. But if system memory isn’t independently important outside of my total memory usage (system + texture), maybe I shouldn’t worry too much about it. [import]uid: 135391 topic_id: 34726 reply_id: 137988[/import]
I am not sure what system memory will really effect.
After my game runs a couple days, playing multiple multiplayer games, it gets a hiccup every 20-30 seconds. I went in search of a memory leak and simply found that all the particles where increasing memory by 2-3MB and then after 20-30 seconds it would clear that 2-3MB all at once. I am not 100% sure if that was my culprit for the pausing. I only recently made the change. But that was the reason for me tweaking the garbage collector timing. I have no memory leak. I hope that solves my issue.
However as you say, concerning memory, I would think it’s simply a matter of system memory + texture memory fitting into available memory and your all good. [import]uid: 56820 topic_id: 34726 reply_id: 137992[/import]
Nate,
All devices vary in memory but I know:
iPhone 3G - 128 MB
iPhone 3GS - 256 MB
iPhone 4/4S - 512 MB
(Source: Michelle M. Fernandez’s “Corona SDK Mobile Game Development”)
Not sure about the newer ones but if you are worried about performance issues due to available memory maybe you could use the event listener “memoryWarning”? https://docs.coronalabs.com/api/event/memoryWarning/index.html
Nate,
All devices vary in memory but I know:
iPhone 3G - 128 MB
iPhone 3GS - 256 MB
iPhone 4/4S - 512 MB
(Source: Michelle M. Fernandez’s “Corona SDK Mobile Game Development”)
Not sure about the newer ones but if you are worried about performance issues due to available memory maybe you could use the event listener “memoryWarning”? https://docs.coronalabs.com/api/event/memoryWarning/index.html