Re: ImageKit + GC = nogo? (or better... how :D)
Re: ImageKit + GC = nogo? (or better... how :D)
- Subject: Re: ImageKit + GC = nogo? (or better... how :D)
- From: "Isaac Wankerl" <email@hidden>
- Date: Sun, 2 Dec 2007 12:19:19 -0600
On 12/2/07, Thomas Goossens <email@hidden> wrote:
> Hi,
>
> I see the same issue. But ImageKit may not be responsible.
> I wrote a simple loop that creates thumbnails using ImageIO .
>
> NO GC
> All is fine: memory usage at the end of the loop : 4.93Mo
>
> WITH GC:
> the memory usage constantly gets higher : at the end of the loop:
> 785.12 Mo
>
> Also using ImageKit with GC turned on but without ImageIO (by showing
> iconRefs for instance) doesn't seems to leak.
> So the issue seems to be in ImageIO or at a lower level.
>
> I filed a new bug.
>
> -- thomas
>
>
> (the code for my test:)
> {
> int i;
>
> NSURL *url = [[NSURL alloc] initFileURLWithPath:@"/Library/
> Desktop Pictures/Nature/Ladybug.jpg"];
>
> NSDictionary *optionsDict = [[NSDictionary alloc]
> initWithObjectsAndKeys:[NSNumber numberWithInt:
> (int)128],kCGImageSourceThumbnailMaxPixelSize,
>
> kCFBooleanTrue,kCGImageSourceCreateThumbnailFromImageIfAbsent,
>
> kCFBooleanTrue,kCGImageSourceCreateThumbnailWithTransform,
>
> kCFBooleanFalse,kCGImageSourceShouldCache,
> nil,nil];
>
> for(i=0; i<400; i++){
> id pool = [[NSAutoreleasePool alloc] init];
>
> CGImageSourceRef sourceRef =
> CGImageSourceCreateWithURL((CFURLRef)url, nil);
> CGImageRef thumbnail =
> CGImageSourceCreateThumbnailAtIndex(sourceRef, 0,
> (CFDictionaryRef)optionsDict);
>
> CGImageRelease(thumbnail);
> CFRelease(sourceRef);
>
> [pool drain];
> [pool release];
> }
>
> [optionsDict release];
> [url release];
> }
Do you see the same memory leak if you use
CGImageSourceCreateWithData() instead of CGImageSourceCreateWithURL()?
I have an application which used CGImageSourceCreateWithURL() and it
always kept the file open even after I had realeased everything. Once
I switched to loading the file into an NSData object and then creating
the CGImageSourceRef every cleaned up nicely.
Isaac
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden