objective-c - NSNumber numberWithInt : is causing memory leak-Xcode

标签 objective-c ios xcode memory-management memory-leaks

我今天一直在处理我程序中的漏洞,我理解其中的大部分漏洞,但这个漏洞让我陷入困境:

[startAndEndPoints addObject:[NSNumber numberWithInt:buttonTag]];

Leaks 工具指出这是 100% 的泄漏。任何人都可以建议吗?

startAndEndPoints 是一个 NSMutableArray。

最佳答案

你有没有将你的情况与iphone app NSNumber memory leak进行比较? ? Leaks 告诉你泄漏的对象是如何创建的,而不是泄漏的位置。您可能稍后将此 NSNumber 对象交给其他人,而其他人过度保留了它。

关于objective-c - NSNumber numberWithInt : is causing memory leak-Xcode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8554695/

相关文章:

objective-c - objective-c : UIScrollView inside a UIScrollView

ios - 在 iOS 10 中清晰和半透明的 UINavigationBar 状态之间的转换

iphone - [__NSArrayM getFileSystemRepresentation :maxLength:]: unrecognized selector sent to instance

swift - 按下键盘后面的按钮时应用程序崩溃

ios - 范围内的iOS随机数

ios - Twitter在Cocos2d-iPhone中的集成

objective-c - 委托(delegate)和 IBAction

objective-c - 将 CoreData 添加到现有项目

ios - 手势结束后,实例变量将重置为零

ios - 从 ITableViewCell 失望?到 UITableViewCell 只解包 optionals