• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Losing my memory - a caching problem?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Losing my memory - a caching problem?


  • Subject: Re: Losing my memory - a caching problem?
  • From: Cem Karan <email@hidden>
  • Date: Tue, 17 Aug 2010 12:53:51 -0400

> From: Stuart Rogers <email@hidden>
> Date: August 17, 2010 6:10:45 AM EDT
> To: email@hidden
> 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 (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

  • Follow-Ups:
    • Re: Losing my memory - a caching problem?
      • From: Ken Ferry <email@hidden>
  • Prev by Date: Re: Does autoreleased NSURLConnection object guarantee job completion?
  • Next by Date: Re: Losing my memory - a caching problem?
  • Previous by thread: Re: Losing my memory - a caching problem?
  • Next by thread: Re: Losing my memory - a caching problem?
  • Index(es):
    • Date
    • Thread