{"id":7053,"date":"2013-02-28T13:16:29","date_gmt":"2013-02-28T18:16:29","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=7053"},"modified":"2014-07-14T10:18:23","modified_gmt":"2014-07-14T14:18:23","slug":"leak-free-recursive-blocks","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2013\/02\/28\/leak-free-recursive-blocks\/","title":{"rendered":"Leak-Free Recursive Blocks"},"content":{"rendered":"<p><a href=\"http:\/\/jeremywsherman.com\/blog\/2013\/02\/27\/leak-free-recursive-blocks\/\">Jeremy W. Sherman<\/a> (via <a href=\"https:\/\/twitter.com\/romainbriche\/status\/307008187490508800\">Romain Briche<\/a>):<\/p>\r\n<blockquote cite=\"http:\/\/jeremywsherman.com\/blog\/2013\/02\/27\/leak-free-recursive-blocks\/\"><p>So you need <em>both<\/em> a strong <em>and<\/em> a weak reference to your block.\r\nAnd the block needs to be stored in the strong reference first,\r\nso you anchor it to this world.<\/p><\/blockquote>\r\n<p>And you also have to make sure that the strong reference outlives the recursion. ARC makes easy things easy, but&#8230;<\/p>\r\n<p><a href=\"http:\/\/blog.hyperjeff.net\/code?id=335\">Jeff Biggus<\/a> wrote macro to simplify this.<\/p>","protected":false},"excerpt":{"rendered":"<p>Jeremy W. Sherman (via Romain Briche): So you need both a strong and a weak reference to your block. And the block needs to be stored in the strong reference first, so you anchor it to this world. And you also have to make sure that the strong reference outlives the recursion. ARC makes easy [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[55,168,941,54,71],"class_list":["post-7053","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-arc","tag-blocks","tag-macros","tag-objective-c","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/7053","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=7053"}],"version-history":[{"count":3,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/7053\/revisions"}],"predecessor-version":[{"id":9147,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/7053\/revisions\/9147"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=7053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=7053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=7053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}