Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

99miles

macrumors member
Original poster
Oct 10, 2008
50
0
I pop up and alert which takes 180k of memory. When it's dismissed I'd expect that memory to be released but it remains allocated in ObjectAlloc even when I've done all i can to release it. I even added NSAutorelease pools around everything and it makes no difference. Anyone know why this is?

Code:
// create a button than when clicked launches an alert...

-(void)addNewGameBtn {
	
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
	launchAlertBtn			= [UIButton buttonWithType:UIButtonTypeRoundedRect];
	[launchAlertBtn setFrame:CGRectMake(20, 250, 280, 30)];
	[launchAlertBtn setTitle:@"Launch Alert" forState:UIControlStateNormal];
	launchAlertBtn.userInteractionEnabled = YES;
	[self.view addSubview:launchAlertBtn];
	[pool release];
}

// pop the alert...
-(void)onLaunchAlertBtnClick:(id)sender {
	
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
	UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"New Game" message:@"Start new game?" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Yes", nil];
	alert.delegate = self;
	[alert show];
	[alert release];
	[pool release];
}

// and for this test I don't do anything the the alert is dismissed
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.