NSAutoreleasepool:iPhone应用程序中的内存管理问题
__NSAutoreleaseNoPool(): Object 0x4c70ec0 of class UISegmentedControl autoreleased with no pool in place - just leaking
__NSAutoreleaseNoPool(): Object 0x4c70ec0 of class UISegmentedControl autoreleased with no pool in place - just leaking
__NSAutoreleaseNoPool(): Object 0x4c70ec0 of class UISegmentedControl autoreleased with no pool in place - just leaking
__NSAutoreleaseNoPool(): Object 0x4c70ec0 of class UISegmentedControl autoreleased with no pool in place - just leaking
__NSAutoreleaseNoPool(): Object 0x4c70ec0 of class UISegmentedControl autoreleased with no pool in place - just leaking
这是我在控制台中收到的警告。虽然它不会造成崩溃,但似乎是一些内存管理问题。
可能出什么问题了?
我还没有自动释放我的分段控件。
__NSAutoreleaseNoPool(): Object 0x4c70ec0 of class UISegmentedControl autoreleased with no pool in place - just leaking
__NSAutoreleaseNoPool(): Object 0x4c70ec0 of class UISegmentedControl autoreleased with no pool in place - just leaking
__NSAutoreleaseNoPool(): Object 0x4c70ec0 of class UISegmentedControl autoreleased with no pool in place - just leaking
__NSAutoreleaseNoPool(): Object 0x4c70ec0 of class UISegmentedControl autoreleased with no pool in place - just leaking
__NSAutoreleaseNoPool(): Object 0x4c70ec0 of class UISegmentedControl autoreleased with no pool in place - just leaking
This is what I get as warning in console. Though it doesnt create a crash but seems to be some memory management issue.
What could be wrong?
I have not autoreleased my segemented control.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您使用多线程时,通常会出现此问题。
如果您使用线程,应该为该线程创建自动释放池
This problem commonly arise when you are using multi-threading.
If you using threading, should create autorelease pool for that thread
如果您在非主线程的线程中使用 UISegmentedControl,如 @Martin 所说,那么它是不安全的。
UIKit 框架参考 - 简介
If you are using UISegmentedControl in a thread that is not main thread as @Martin said, it is not safe.
UIKit Framework Reference - Introduction