Memory leak with CIImage

  • Hi,

    if I load a raw image using
    CIImage *img=[CIImage imageWithContentsOfURL:url];
    I leak 16384000 bytes of memory for a 15.7 MB RAW file.

    The call stack in ObjectAlloc is like this:

    +[CIImage imageWithContentsOfURL:options];
    -[CIImage initWithContentsOfURL:options:];
    CGImageSourceCreateWithURL
    CGImageSourceCreateWithFile
    CGImageReadCreateWithFile
    _CFDataCreateWithMappedFile
    __CFDataInit
    _CFRuntimeCreateInstance
    CFAllocateAllocate

    The following code in a normal C command line tool does not leak:

    #include <Cocoa/Cocoa.h>
    #include <QuartzCore/QuartzCore.h>
    #include "stdio.h"

    int main (int argc, const char * argv[]) {

            NSApplicationLoad();
            [NSApplication sharedApplication];

        NSAutoreleasePool* pool=[[NSAutoreleasePool alloc] init];
            NSURL *url=[NSURL
    fileURLWithPath:@"/Users/cs/Desktop/D200.nef"];
            CIImage *img=[CIImage imageWithContentsOfURL:url];

            NSLog(@"url %@",url);
            NSLog(@"img %@",img);

            [pool release];

            int i;
            scanf("%d",&i);

            return 0;
    }

    Now in my method I do the same.

                    NSURL *url=NewNSURL(c);
                    CIImage *img=[CIImage imageWithContentsOfURL:url];

    with the NSApplication load code run earlier.
    I have Autorelease pools around.
    Even if I do not decide to use the img returned, it leaks.

    Can someone please help me?

    Does the GUI code around maybe set some cache options so the CFData
    object is not released?

    Gruß
    Christian

    --
    Over 800 classes with 16000 functions in one REALbasic plug-in.
    The Monkeybread Software Realbasic Plugin v7.5.

    <http://www.monkeybreadsoftware.de/realbasic/plugins.shtml>
previous month september 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Go to today