Received memory warning source

363 Views Asked by At

After getting numerous memory warnings in the console , I tried using the memory profile tool to understand the root cause. But I don't see any strange behavior in memory allocations.

Is there a way to know what exactly is causing the warning?

Edit:

Print screen of profiler Thanks for any guidance

enter image description here

sorted By "Overall Bytes" and "Created and Still living"

enter image description here

and added some detail to that:

enter image description here

and the code detail:

enter image description here

1

There are 1 best solutions below

3
On

There is no single reason for memory warning. First of all you should always profile on real device - never simulator.

Add a profiler gadget called "leaks" to search for memory leaks on profiler while doing profiling.

You can get memory warning depending on a device even at around 10 - 12MB used by your application. Unfortunately there is no official information from Apple how much you can safely use.

In profile check also Total Living bytes. Try optimizing your code with autoreleasepools (if you are doing lot's of object allocation in "for" loops for example.

You can also check in Profile which objects takes most space.

Without real project to play with - it will be really hard to point a problem. Depending if it's a game and how much images you're using - problem may be different.