Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I recently tuned my app to be more memory efficient and ran into a weird memory problem on iOS5. Note my app does not have automatic reference counting turned on. First, I got the live memory from 15Mb down to 10Mb and it works great on any iOS6 device and the iOS6 simulator. When I ran the tuned app on iOS5 (iPad or simulator), it hits a point at startup where it spikes >100Mb within a second and usually gets terminated. The memory that's spiking is happening purely in iOS code.

I've attached two instruments screen shots - the first showing the spike, and the second showing a malloc call which causes it - note the stack trace on the right. All those large malloc calls are in the same point of the code.

I'm at a loss as to what could be causing this. I've read several posts about leaks in Core Graphics and the stack trace shows that. My best guess about what's happening is that somehow the change to make the app more memory efficient triggered something in Core Graphics that makes it want to use (and leak) more memory, but only in iOS5.

Any ideas or insights as to what might be the cause and how to fix it would be appreciated.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.
{"cc_re__cc_re__cc_by_sa_3_0": ["                       <li><a href=\"//area51.stackexchange.com\" title=\"proposing new sites in the Stack Exchange network\">Area 51</a></li>\r\n                        <li><a href=\"//careers.stackoverflow.com\">Stack Overflow Careers</a></li>\r\n                    \r\n                </ol>\r\n            </td>\r\n    </tr>\r\n</table>\n                </div>\n            </div>\n\n            <div id=\"copyright\">\n                site design / logo &#169; 2016 Stack Exchange Inc; user contributions licensed under <a href=\"https://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc by-sa 3.0</a> \n                with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\n            </div>\n            <div id=\"svnrev\">\n                rev 2016.2.10.3243\n            </div>\n            \n        </div>\n    </div>\n    <noscript>\n        <div id=\"noscript-warning\">Stack Overflow works best with JavaScript enabled<img src=\"http://pixel.quantserve.com/pixel/p-c1rF4kxgLUzNc.gif\" alt=\"\" class=\"dno\"></div>\n    </noscript>\n<scr"], "copyright__copyright__copyright": ["shows that. My best guess about what's happening is that somehow the change to make the app more memory efficient triggered something in Core Graphics that makes it want to use (and leak) more memory, but only in iOS5.\n\nAny ideas or insights as to what might be the cause and how to fix it would be appreciated.\n\nshare|improve this question\n\nYour Answer\n\n\u00a0\ndiscard\n\nBy posting your answer, you agree to the privacy policy and terms of service.\n\nBrowse other questions tagged or ask your own question."]}