How to release a block

ios, memory-management, objective-c, objective-c-blocks

Solution

`Block_release()` is there for when you're only using blocks in C, and not Objective-C.

When using Objective-C you can use the `release` and `copy` methods to make your code look and feel more like the rest of the ObjC around it.

I imagine they both do exactly the same thing, and that the objc method is just a wrapper around the call to `Block_release()` anyway.

Problem

I am storing my blocks while my web service goes off and talks to my server. Therefore I am using `[myBlock copy]` to keep a reference to my block. Once I have got my data, and executed the block, do I call `[myBlock release]`, or do I use `Block_release(myBlock)` ? I can find reference to both.

Original source