{"id":4149,"date":"2014-03-30T08:28:25","date_gmt":"2014-03-30T08:28:25","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/using-instruments-to-work-through-low-memory-warnings-collection-of-common-programming-errors\/"},"modified":"2014-03-30T08:28:25","modified_gmt":"2014-03-30T08:28:25","slug":"using-instruments-to-work-through-low-memory-warnings-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/using-instruments-to-work-through-low-memory-warnings-collection-of-common-programming-errors\/","title":{"rendered":"Using Instruments to Work Through Low Memory Warnings-Collection of common programming errors"},"content":{"rendered":"<p>I am trying to work through some low memory conditions using instruments. I can watch memory consumption in the Physical Memory Free monitor drop down to a couple of MB, even though Allocations shows that All Allocations is about 3 MB and Overall Bytes is 34 MB.<\/p>\n<p>I have started to experience crashing since I moved some operations to a separate thread with an NSOperationQueue. But I wasn&#8217;t using instruments before the change. Nevertheless, I&#8217;m betting I did something that I can undo to stop the crashes.<\/p>\n<p>By the way, it is much more stable without instruments or the debugger connected.<\/p>\n<p>I have the leaks down to almost none (maybe a hundred bytes max before a crash).<\/p>\n<p>When I look at Allocations, I only see very primitive objects. And the total memory reported by it is also very low. So I cant see how my app is causing these low memory warnings.<\/p>\n<p>When I look at Heap Shots from the start up, I don&#8217;t see more than about 3 MB there, between the baseline and the sum of all the heap growth values.<\/p>\n<p>What should I be looking at to find where the problem is? Can I isolate it to one of my view controller instances, for example? Or to one of my other instances?<\/p>\n<p><strong>What I have done:<\/strong> I powered the device off and back on, and this made a significant improvement. Instruments is not reporting a low memory warning. Also, I noticed that Physical Free Memory at start up was only about 7 MB before restarting, and its about 60 MB after restarting.<\/p>\n<p>However, I am seeing a very regular (periodic) drop in Physical Free Memory, dropping from 43 MB to 6 MB (an then back up to 43 MB). I would like to knwo what it causing that. I don&#8217;t have any timers running in this app. (I do have some performSelector:afterDelay:, but those aren&#8217;t active during these tests.)<\/p>\n<p>I am not using ARC.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am trying to work through some low memory conditions using instruments. I can watch memory consumption in the Physical Memory Free monitor drop down to a couple of MB, even though Allocations shows that All Allocations is about 3 MB and Overall Bytes is 34 MB. I have started to experience crashing since I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4149","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4149"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4149\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}