Q:

CGPDFDocumentRef and autorelease

Is there an autorelease analogous method for CGPDFDocumentRef instances? I'd like to apply this before returning an instance I created. Or can I only do CGPDFDocumentRelease(...) before returning (which is surely wrong)?
Since I created the CGPDFDocumentRef I'd like to take care with its release.

A:

The best thing you can do is to write an Obj-C wrapper around CGPDFDocumentRef and release the  CGPDFDocumentRef on your wrapper's dealloc method so the rest of your code will retain/release your wrapper as with ay other NSObject derivate and once the wrapper's retain count reaches zero the CGPDFDocumentRef will be released on the wrapper's dealloc method and consequently freed from memory as it's retain count never got past 1.

