> From: Stuart Rogers <stuart.rog...@me.com>
> Date: August 17, 2010 6:10:45 AM EDT
> To: cocoa-dev@lists.apple.com
> Subject: Losing my memory - a caching problem?
> 
> I'm having enormous difficulty keeping tabs on memory usage in my current
> project.  I'm happy that I'm not leaking anything - Build & Analyse reports no
> issues, and neither does Instruments (Object Allocations and Leaks).  And yet,
> when watching bulk memory usage I see my free RAM dropping like a stone
> (at the expense of my inactive RAM) and within seconds it has chewed through
> 8GB and starts kicking off extra page files.  The active RAM usage is fairly
> modest, and nearer to what I would expect.
> 
> <<SNIP>>
> 
> - (ImageSignature*)signatureForImage:(CGImageRef)img
> {
>    // Create a CIImage by passing the image through our filter chain.
>    CIImage *ciImage = [self filteredImage:(CGImageRef)img];
> 
>    // Create a bitmap and paint our CIImage into it.
>    NSBitmapImageRep *inBmpImgRep = [[[NSBitmapImageRep alloc] 
> initWithCIImage:ciImage] autorelease];
>    NSInteger pixelsWide = [inBmpImgRep size].width;
>    NSInteger pixelsHigh = [inBmpImgRep size].height;
>    NSInteger samplesPerPixel = 4;
>    NSBitmapImageRep *bmpImgRep = [[[NSBitmapImageRep alloc] 
> initWithBitmapDataPlanes:NULL
>                                  pixelsWide:pixelsWide pixelsHigh:pixelsHigh 
> bitsPerSample:8
>                                  samplesPerPixel:samplesPerPixel hasAlpha:YES 
> isPlanar:NO
>                                  colorSpaceName:NSDeviceRGBColorSpace 
> bitmapFormat:0
>                                  bytesPerRow:0 bitsPerPixel:0] autorelease];
>    [NSGraphicsContext saveGraphicsState];
>    [NSGraphicsContext setCurrentContext:[NSGraphicsContext 
> graphicsContextWithBitmapImageRep:bmpImgRep]];
>    [inBmpImgRep draw];
>    [NSGraphicsContext restoreGraphicsState];
> 
>    // Create an ImageSignature and paint our bitmap into it.
>    ImageSignature *sig = [[[ImageSignature alloc] initWithSize:[bmpImgRep 
> size]] autorelease];
>    float *buffer = [sig allItems];
> 
>    // Signature creation snipped - it's a simple mapping of pixels to a float 
> array
> 
>    return sig;
> }
> 
> <<SNIP>>

One dumb question; I see where you're putting images into an autorelease pool, 
but I don't see you setting up or tearing down pools.  Where are you doing that?

Thanks,
Cem Karan_______________________________________________

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