Re: Retained items and autorelease pool
Re: Retained items and autorelease pool
- Subject: Re: Retained items and autorelease pool
- From: "Erik M. Buck" <email@hidden>
- Date: Tue, 7 Aug 2001 13:54:06 -0500
>
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
>
... much code here...
>
... in some subroutine somewhere:
>
// myString is a loose global variable, not a class member of
>
anything
>
myString = [[NSString stringWithCString:someString] retain];
>
... much other code here ...
>
... back in earlier routine:
>
[pool release];
>
>
Did I just lose myString? If so, how do I allocate things that don't get
>
cleaned up by releasing the pool?
You do not loose myString because it was never in pool because it was never
autoreleased. This is not hard stuff. RTFM.