objective-c - IOS main 函数中为何要包着 autoReleasePool ?
ringa_lee
ringa_lee 2017-04-24 16:00:32
0
1
373

包着有何意义?不包似乎也没有出问题。

ringa_lee
ringa_lee

ringa_lee

reply all(1)
左手右手慢动作

First of all, you need to know what is an automatic release pool in OC?
Answer: The Autorelease pool is an automatic memory recycling mechanism of OC. Some temporary variables can be recycled and released uniformly through the automatic release pool. As long as any OC object calls the autorelease method, the object will be placed in the nearest autorelease pool (the release pool on the top of the stack).

My personal guess is that the reason why the questioner thinks "there seems to be no problem if you don't include it" is that you are not involved in object orientation. In this case, it is recommended to learn the relevant knowledge of "memory management and automatic reference counting".

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template