HI i have questions on Memory 开发者_如何学PythonManagement If I alloc object 1 time then i retain 2 time And then release 4 time & then retain 1 time for same object. what will be my final ans?
Crrrrraaassshh!
The object will be dealloced after the third release (when the retainCount
hits zero) and the fourth release
will be sent to a non-valid object, resulting in a crash.
If you want an object to exist for a little while after you've released it, you should look into the autorelease
method.
精彩评论