OK, after much wailing and gnashing of teeth I have worked out my mistake. 
Where I wrote the following:
>       NSImage *frameImage = [[NSImage alloc] 
> initWithContentsOfFile:NSStringForFrameNumber(i)];
> 
>       // Temp code to debug serious memory leak
>       NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
> 
>       NSBitmapImageRep *bitmapRep = RawBitmapFromImage(frameImage);
>       /*      If I comment out the following line then there are no major 
> leaks.
>               With this line in place, bitmapData is leaked, in that 
> ObjectAlloc
>               shows a whole load of allocations from within the call to 
> bitmapData
>               that build up until all memory is full. */
>       unsigned char * bitMapDataPtr = [bitmapRep bitmapData];
> 
>       [pool drain];
>       [frameImage release];           // I have tried swapping these two 
> calls around, to no effect (unsurprisingly)...

what was happening was that *** frameImage *** was not being autoreleased until 
the full loop was over (obviously). Although the actual pixel data allocation 
was occuring within the scope of my autorelease pool, that buffer was not being 
freed up until the image object itself was autoreleased. I guess that makes 
sense, though I'm finding this sort of autorelease consideration rather hard to 
get to grips with...

Jonny

_______________________________________________

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