If I do this:


int main (int argc, const char * argv[]) { @autoreleasepool { [[ball alloc] init]; } return 0; }

Does an object get created on the heap at random then the program ends (taking the object with it)?


Assuming ball is a class (should be capitalized per convention, I believe) then:
[ul][li]Yes, memory is allocated on the heap[/li]
[li]It can actually be released before the program ends (at the end of the @autoreleasepool block)[/li]
[li]In practice, depending on what the alloc & init methods do, it would be within the compiler’s purview to do neither of the above, I believe, and just optimize the statement out of existence[/li][/ul]