small medium large xlarge

Generic-user-small
29 Oct 2010, 11:21
Matthew Whillock (8 posts)

Hi,

Running the code in chapter 15 with instruments indicates a leak right at the beginning of the program. I finally nailed the line in IconView.m:

self.imageView = [[NSImageView alloc] initWithFrame:imageRect];

in awakeFromNib (although I don’t use that method but the initWithFrame: method provided in the template). Plugged that leak with:

self.imageView = [[[NSImageView alloc] initWithFrame:imageRect] autorelease];

My guess is the alloced imageView was getting a retain count of 2 when given to IconView’s imageView. (?)

There is a leak every time an app is launched and terminated (in my program at least) but these appear to be due to the leaky frameworks I guess - at least nothing I do gets rid of them.

Cheers, Matt

You must be logged in to comment