简体   繁体   English

iOS发布内存管理

[英]iOS release memory management

I had a question, regarding iOS memory management. 我有一个关于iOS内存管理的问题。 Does iOS release memory instantly after calling release message with initial retain counter equal to 1? 调用初始保留计数器等于1的释放消息后,iOS是否会立即释放内存?

Usually, yes. 通常是的。 Release decrements the retain counter, and if it becomes 0, 'dealloc' is called and it is freed immediately. Release递减保留计数器,如果它变为0,则调用'dealloc'并立即释放它。 However, you shouldn't rely on the value of the retain counter, as it doesn't give any useful information. 但是,您不应该依赖保留计数器的值,因为它不会提供任何有用的信息。 Follow the paradigms or use ARC. 遵循范例或使用ARC。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM