Re: Monster memory leak and I can't figure out why
Re: Monster memory leak and I can't figure out why
- Subject: Re: Monster memory leak and I can't figure out why
- From: Ken Ferry <email@hidden>
- Date: Tue, 1 Jun 2010 12:57:49 -0700
On Tue, Jun 1, 2010 at 11:22 AM, Jens Alfke <email@hidden> wrote:
>
> On May 31, 2010, at 6:41 PM, Ken Tozier wrote:
>
> > What's happening is that if I comment out the line that initializes a new
> image, the memory leak disappears. I've tried forcibly releasing the images,
> tried autoreleasing them, tried creating a fixed size buffer into which all
> the images are read, nothing seems to work.
>
> First off, -retain / -release / -autorelease are all no-ops when GC is
> enabled, so calling them won’t make any difference.
>
> NSImage does some caching behind the scenes, by default, and this might not
> be getting cleaned up in a timely enough manner. You could try using the
> caching-related NSImage methods to try to reduce this.
>
> (A common issue in GC environments is that the collector isn’t aware of
> large external memory buffers that aren’t in the GC heap but are kept around
> by GC’d objects. So in this case the collector may not realize that,
> although the NSImage objects themselves are small, they’re holding onto
> large pixmap buffers in the malloc heap. So it probably isn’t running
> frequent enough collections to free up that memory.)
>
NSImage specifically allocates its memory buffers from the GC heap
(unscanned) to avoid this.
-Ken
Cocoa Frameworks
>
> Another option is to directly tell the collector to run a collection after
> every pass through your loop.
>
> —Jens_______________________________________________
>
> 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
>
_______________________________________________
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