gpt4 book ai didi

iphone - NSTimer 不间断内存增加 - iOS 错误?

转载 作者:行者123 更新时间:2023-11-29 13:50:52 26 4
gpt4 key购买 nike

我正在使用工具解决 iPad 应用程序的内存问题 - 查看分配的总字节数。我的 NSTimer 导致字节不断增加,而将其注释掉导致内存使用量保持不变。

来 self 的 View Controller 的 viewDidLoad:

tickTime = 1.0 / 30.0;
tickTimer = [NSTimer scheduledTimerWithTimeInterval:tickTime target: self selector:@selector(update2) userInfo: nil repeats: YES];

和方法更新2:

- (void) update2 {

}

如您所见,该方法未执行任何操作 - 但应用程序的内存使用量不断增加。如果我注释掉设置计时器的行,内存使用量保持不变。

这是 iOS SDK 中的错误吗?有人知道解决方法吗?

最佳答案

这是一个 pebkac 问题 - 我正在研究 Instruments 中的“总字节数”,这是对应用程序曾经使用过的所有内存的度量,而不是当前内存使用量的度量。

我仍然很好奇如何测量应用程序当前的总内存使用量 - 因为“实时字节”约为 1.5mb - 即使加载了至少 20mb 的 .png。

关于iphone - NSTimer 不间断内存增加 - iOS 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4432576/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com