Search code examples
iphonemkmapviewdidreceivememorywarning

Responding to didReceiveMemoryWarning oddity


So I have a map with a heap of MKPolygonViews overlaid. When I put a couple on it chugs a bit and then if I put them all on the systems sends a didReceiveMemoryWarning to the system that I've responded to by removing the overlays.

Now I wondered how much memory it was actually using when this happens, it's only 10MB real memory and 100MB virtual memory. The SMS app at the time was using 30MB of memory and was running fine. There are also other Apps like mail using more than my App. SpringBoard rises 5MB so nothing too special. This is also running on an iPhone 4 so there should be plenty of memory left (my calculations is about 256MB still free).

After I remove the overlays the memory foot print only goes down about 1MB, when I turn them back on it goes up 1MB so nothing unusual.

So what is going on? Is the memory warning coming from the perhaps the graphics memory or something? Is its performance with these overlays being limited by the graphics processor? With them all turned on it does use about 60% when moving around but that wouldn't explain the bad performance.

Any direction to the answer would be appreciated.

EDIT: Springboards Virtual memory rises to 450MB with the overlays turned on and as soon as it reaches 512MB it sends a memory warning. Is this whats causing the issue? The total VM is always above 512MB so it must be using the flash storage for the VM and thus shouldn't cause a memory warning


Solution

  • The solution was to merge all the MKPolygonViews into one MKpolygonView. Further details can be found here