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.)

Another option is to directly tell the collector to run a collection after 
every pass through your loop.

—Jens_______________________________________________

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