{"id":4595,"date":"2014-03-30T13:48:03","date_gmt":"2014-03-30T13:48:03","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/is-this-an-efficient-use-of-uiimage-collection-of-common-programming-errors\/"},"modified":"2014-03-30T13:48:03","modified_gmt":"2014-03-30T13:48:03","slug":"is-this-an-efficient-use-of-uiimage-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/is-this-an-efficient-use-of-uiimage-collection-of-common-programming-errors\/","title":{"rendered":"Is this an efficient use of UIImage?-Collection of common programming errors"},"content":{"rendered":"<p>Well, it depends on how you&#8217;re getting the UIImage.<\/p>\n<p>Are you using +[UIImage imageNamed:] each time you create a new Person object? If so, UIKit caches the image and returns references to a single copy in memory. You retain it to make sure it stays loaded, then release it when you&#8217;re done referencing it, but only one UIImage object is created in memory.<\/p>\n<p>If, on the other hand, you&#8217;re calling +[UIImage initWithData:] or [[UIImage alloc] initWithContentsOfFile:] you&#8217;re creating a new copy in memory each time (and you probably need to stop that \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Well, it depends on how you&#8217;re getting the UIImage. Are you using +[UIImage imageNamed:] each time you create a new Person object? If so, UIKit caches the image and returns references to a single copy in memory. You retain it to make sure it stays loaded, then release it when you&#8217;re done referencing it, but [&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-4595","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4595","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=4595"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4595\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4595"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4595"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4595"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}