Question

So I am creating my first opengl es application on the iphone. I want to autorelease an object and that was around the time I noticed that I can't seem to find the location of the autorelease pool.

1) Is the autorelease pool already created for me in an iphone opengl es application? 2) If it is already created for me how often is the pool being drained?

Was it helpful?

Solution

Do you have a main.m? If you are using the standard GL ES app template, you should see:

int main(int argc, char *argv[]) {

    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    int retVal = UIApplicationMain(argc, argv, nil, nil);
    [pool release];
    return retVal;
}

If so, then you do have an autorelease pool and it gets drained everytime you go through the runloop.

OTHER TIPS

Under the folder Other Sources I found a file called main.m

it has the autorelease pool. it seems to only drain at the end of the application

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top