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

XcodeNewb

macrumors member
Original poster
Feb 6, 2009
79
0
Do autoreleasepool's carry over from one method to another?

I am creating an autorelesae pool in one method and then using autorelease in another method and I am assuming that the objects are being added to my pool but I do not know how to tell for sure.

Here is some sampe code

Code:
- (void)parserDidStartDocument:(NSXMLParser *)parser

	myPool = [[NSAutoreleasePool alloc] init];

        /* Do some Stuff */
}

-(void)myOtherMethod
{
    contentOfCurrentElement = [[[NSMutableString alloc] init] autorelease];
}


- (void)parserDidEndDocument:(NSXMLParser *)parser {
	[myPool release];
}

Is it safe to say that "contentOfCurrentElement" is being added to myPool's pool, and is released when the [myPool release] is called?

Or does myPool only hold objects that are autoreleased in the parserDidStartDocument method?

Thanks for the insight.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.