ios - Why must block be copied and not retained? When do you not need to copy a block? -
why must block copied , not retained? difference between 2 under hood? under condition not need copy block, if any?
usually when allocate instance of class, goes in heap , sticks around until gets deallocated. if declare block inline code, goes on stack. when stack frame goes away, block instance-- unless copy it, creates heap-resident instance. basically, if want continue using block after stack frame gets popped, need make copy somewhere.
Comments
Post a Comment