So as you can see, at the top of the method the context is being created, so by convention it has a retain count of +1. Then the context is used to draw an pdf into it, which is then copied out to an image so that it can be returned by the method. The image ref also has a retain count of +1, because that*s how the creation convention works. It is then the developer*s responsibility to release those references, which you can see is done in this example. So far so good. We knew from instruments that the image context was being leaked, but we still didn*t know how or why. But since we could tell both from our own inspection, and reading Apple*s sample code for this exact use case, that it was being done correct, we went back to the drawing board.