The application will crash.
Reason:
when alloc is called on Ball, object will be created and its retain count will be set to one.
Because of autorlease calls the ball object will be added to autorelease pool twice.
When pool is getting released release method will be called on the ball object twice.
When first time release method is called ball objects reatin count will become zero and object will be destroyed.Now when second time release method is called on that destroyed object application will crash.
Reason:
when alloc is called on Ball, object will be created and its retain count will be set to one.
Because of autorlease calls the ball object will be added to autorelease pool twice.
When pool is getting released release method will be called on the ball object twice.
When first time release method is called ball objects reatin count will become zero and object will be destroyed.Now when second time release method is called on that destroyed object application will crash.
No comments:
Post a Comment