Re: NSImage TIFFRepresentation memory leak
Re: NSImage TIFFRepresentation memory leak
- Subject: Re: NSImage TIFFRepresentation memory leak
- From: Roland Torres <email@hidden>
- Date: Wed, 29 Nov 2006 17:43:32 -0800
On Nov 29, 2006, at 12:39 PM, j o a r wrote:
On 29 nov 2006, at 21.25, Roland Torres wrote:
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[anImage lockFocus];
NSData *nsData = [anImage TIFFRepresentation]; // <-- Leak City
[anImage unlockFocus];
[nsData writeToFile::]; // <-- No leak here
[pool release];
Why do you bracket the call to TIFFRepresentation inside calls to
lockFocus/unlockFocus?
There, just as a test. I've removed them; no difference.
Any ideas?
Check the memory management history for your tiff-data using
ObjectAlloc. That should tell you what's going on.
Here's the backtrace from ObjectAlloc stemming from the line in
question. I'm not sure what it's saying, other than
TIFFRepresentation keeps allocating more and more memory...?
GLEngine-2560
start
_start
main()
NSApplicationMain
-[NSApplication run]
-[NSApplication sendEvent:]
-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
_DPSNextEvent
BlockUntilNextEventMatchingListInMode
ReceiveNextEventCommon
RunCurrentEventLoopInMode
CFRunLoopRunSpecific
__CFRunLoopRun
__CFRunLoopDoSources()
__CFRunLoopPerformPerform
__NSFireMainThreadPerform
-[MyController writeImageToFile:] <-- The
method in my program is here
-[NSImage TIFFRepresentation]
-[NSImage
TIFFRepresentationUsingCompression:factor:]
-[NSImage _cacheRepresentation]
-[NSImage _cacheRepresentation:stayFocused:]
-[NSImage drawRepresentation]
-[NSImage drawRepresentation:inRect:]
-[NSCIImageRep drawAtPoint:]
-[NSCIImageRep drawInRect:]
-[CIContext drawImage:inRect:fromRect:]
-[CICGContextImpl render:]
CGContextDrawImage
CGContextDelegateDrawImage
0x9475ccd0
0x9475e538
CGSImageDataLockWithReference
img_data_lock
CGAccessSessionGetBytePointer
provider_get_byte_pointer
provider_ensure_data
fe_image_get_bitmap
fe_image_render_
fe_tree_render_image
fe_tree_render_image_
fe_tree_prepare_image
fe_tree_expand_2
fe_tree_expand_2
fe_tree_expand_2
fe_tree_expand_2
fe_tree_expand_2
fe_tree_expand_2
fe_tree_expand_2
fe_tree_expand_2
fe_context_promote_format
fe_gl_buffer_format_p
fe_accel_context
fe_accel_context_
create_context
fe_cgl_create_account
allocate_context
CGLCreateContext
cglInitializeContext
0x15380b8
0x1538e14
0x153a980
0x153aa44
Roland
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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