• 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
This code is leaking...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

This code is leaking...


  • Subject: This code is leaking...
  • From: Tony Cate <email@hidden>
  • Date: Sun, 19 Jun 2011 10:29:08 -0400

- (NSImage *)illustration
{
if ( illustrationData != nil ){
NSImage* thisImage = [NSImage new];
NSBitmapImageRep* bitmapImageRep = [[NSBitmapImageRep alloc] initWithData:illustrationData];
NSPICTImageRep* pictImageRep = [[NSPICTImageRep alloc] initWithData:illustrationData];


if ( bitmapImageRep != nil ){
NSLog(@"bitmapImageRep retainCount", [bitmapImageRep retainCount]);
[thisImage addRepresentation:bitmapImageRep];
NSLog(@"bitmapImageRep retainCount", [bitmapImageRep retainCount]);
[bitmapImageRep release];
NSLog(@"bitmapImageRep retainCount", [bitmapImageRep retainCount]);
}
if ( pictImageRep != nil ){
[thisImage addRepresentation:pictImageRep];
[pictImageRep release];
}
return thisImage;
}
return nil;
}


The logs look like this:

2011-06-19 09:42:49.817 MyTestApp[92772:903] thisBitmapImageRep retainCount: 2
2011-06-19 09:42:49.820 MyTestApp[92772:903] thisBitmapImageRep retainCount: 3
2011-06-19 09:42:49.822 MyTestApp[92772:903] thisBitmapImageRep retainCount: 2


bitmapImageRep is leaking. Why is the retain count 2 after the initWithData:? Should I file a bug?

Tony



_______________________________________________

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: This code is leaking...
      • From: Jens Alfke <email@hidden>
    • Re: This code is leaking...
      • From: Mike Abdullah <email@hidden>
  • Prev by Date: Re: Synthesised properties and additional actions
  • Next by Date: Re: How to redraw a view in slow-motion
  • Previous by thread: Re: Non-rectangular image of NSView for dragging
  • Next by thread: Re: This code is leaking...
  • Index(es):
    • Date
    • Thread