0

I did receive these warnings in my iOS app

Received memory warning. Level=1
Received memory warning. Level=2

The problem is, after Level=2 warning, my app will be killed... How many MB of memory my app could use until I receive such warnings? I'm getting < 30Mb of "Live Bytes" in XCode Instruments before my app gets killed for level 2 memory warning. Is this my reading mistakes, or am I not suppose to use more than 30Mb of memory in my app?

I am testing using iPod Touch 4th Gen and iPhone 4, and targeting those devices as minimum.

Any advice are appreciated, and thanks in advance!

Zennichimaro
  • 5,236
  • 6
  • 54
  • 78
  • Skyler Saleh provides a reliable detail of "acceptable" RAM usage for iOS app here: http://stackoverflow.com/questions/6044147/memory-limit-and-ios-memory-allocation-in-iphone-sdk – Zennichimaro Oct 18 '12 at 09:12
  • 1
    TODO: try different instrumentation, was using "Memory Allocation" instrumentation, but a colleague is running fine with 100+ Mb on his xcode instrumentation. I'm quite sure our app is using more than 30Mb at any time when running – Zennichimaro Oct 18 '12 at 09:14

2 Answers2

1

first of all I will ask myself what are you loading into memory that takes so much space. Second if you are releasing everything in the correct way. ARC simplify our lives but is not a garbage collector, there could be abandoned memory and other issues that makes memory grow. In iphone 3gs the limit of memory is about 25MB, when you reach it you get a memory warning, if your app is not able to flush some memory after that it will close.

Andrea
  • 26,120
  • 10
  • 85
  • 131
  • "first of all I will ask myself what are you loading into memory that takes so much space." - This is really the best advice because you can't control how much memory is available to you (OS decides that depending on availability). All you can do is a) use as little memory as possible and b) respond appropriately to the first memory warning. – sosborn Oct 18 '12 at 02:04
  • I am just loading all the textures needed to render the scene. One uncompressed texture already use up 4Mb of RAM (1024x1024x32Bit). It was running on 3GS and still runs on 3GS, so I'm quite sure the ceiling is not 30Mb. I'll try to profile again later. Thanks for the input! – Zennichimaro Oct 18 '12 at 09:29
0

If you want to support old devices like iPhone 3GS I would suggest not to exceed 12-15MB.

atxe
  • 5,029
  • 2
  • 36
  • 50