Hi all,

   I've recently upgraded to Mac OS X 10.6.2 in order to run the Analyzer for 
Xcode and it's pointing out some potential memory leaks that really have me 
confused. A typical example is where I have a method that allocates and returns 
something like a CGPDFDocumentRef or CGContextRef. The analyzer reports that  
the object allocated and stored in the variable is potentially being leaked, 
however, if I call the appropriate release, such as CGPDFDocumentRelease or 
CGContextRelease in the calling method it's reported as an incorrect decrement 
of an object not owned by the caller. 

   Is this just a limitation in the ability of the Analyzer to track the 
allocation/freeing of an object or am I missing something fundamental. 

Sample below:

- (id)callingMethod: {  
    CGPDFDocumentRef    documentRef;
    const char          *buffer;

    snip...

    documentRef = [self getPDFDocumentRef:buffer];

    snip...

    CGPDFDocumentRelease(documentRef);

    return xxxxx;
}

- (CGPDFDocumentRef)getPDFDocumentRef:(const char *)filename { 
        CGPDFDocumentRef        document; 

        snip...

        document = CGPDFDocumentCreateWithURL(url); 
        return document; 
} 


thanks,

Bob_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to