• 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
Re: Memory management puzzle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory management puzzle


  • Subject: Re: Memory management puzzle
  • From: Jens Miltner <email@hidden>
  • Date: Thu, 27 Nov 2008 14:23:08 +0100


Am 27.11.2008 um 03:49 schrieb DKJ:

I've got something this in my code, which is run several times by the app:

	UIView *subView = [[MyView alloc] initWithFrame:frame];
	[theView addSubview:subView];
	[subView release];

Later on this happens:

	[subView removeFromSuperView];
	subView = nil;

These two code snippets are in different controller methods. I'm certain they're called the same number of times.

The docs say that subView gets a release message when removeFromSuperview is called. But the NSLog statement I put in the dealloc method for MyView is never called. The ObjectAlloc instrument shows the count of MyView instances increasing by 1 each time the code is run. And the Leaks instrument shows no leaks at all.

Enable refcount tracking ("Record reference counts" option for the ObjectAlloc instrument) and see who retains and releases your MyView instance. This will get you a nice stacktrace for each call to retain, release or dealloc...
There might be other objects holding on to the view.


HTH,
</jum>

_______________________________________________

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


References: 
 >Memory management puzzle (From: DKJ <email@hidden>)

  • Prev by Date: Re: set position of Alert panel
  • Next by Date: Re: Scheme for efficiently archiving images.
  • Previous by thread: Re: Memory management puzzle
  • Next by thread: how to set up nextKeyView, full keyboard access etc, for custom subviews set up in code (rather than nib)
  • Index(es):
    • Date
    • Thread