title: CGPDFDocumentCreateWithURL ARC Memory Leak
body: <p>I want to render PDFs on iOS and I'm getting a memory leak when I call <strong>CGPDFDocumentCreateWithURL()</strong>. I know this issue has been discussed before, but I don't know whether my conditions are different because I'm using ARC.</p>
  
  <p>I've extracted and simplified the problem by running the following code on my viewDidLoad:</p>
  
  <pre><code>// Bridge resourceRef to ARC with no ownership change (still owned by ARC)
  CFURLRef resourceRef = (__bridge CFURLRef) [NSURL fileURLWithPath:htmlPath];
  
  CGPDFDocumentRef pdf;
  pdf = CGPDFDocumentCreateWithURL(resourceRef);
  CGPDFDocumentRelease(pdf);
  
  // Do not need to release resourceRef because ARC will release it
  </code></pre>
  
  <p>Instruments tells me that the Leaked Object is a Malloc 48 Bytes, responsible by CoreGraphics. And the stacktrace has CGPDFDocumentCreateWithURL in it. Leaking means that there is object out there without an owner.</p>
  
  <p>I've create a git repo with a replication of the problem:
  <a href="https://github.com/indika/PDFLeaks" rel="nofollow">https://github.com/indika/PDFLeaks</a></p>
  
  <p>Any ideas. Would appreciate any help or 'pointers'.</p>