NSTimer不间断内存增加 - iOS错误? [英] NSTimer nonstop memory increasing - iOS bug?

查看:134
本文介绍了NSTimer不间断内存增加 - iOS错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm figuring out memory issues with an iPad app using instruments - looking at the overall allocated bytes. My NSTimer causes the bytes to constantly increase, while commenting it out causes memory usage to remain static.

来自我的视图控制器的viewDidLoad:

From viewDidLoad of my view controller:

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

方法update2:

- (void) update2 {

}

正如您所看到的,该方法没有任何工作 - 但应用程序的内存使用量不断增长。如果我注释掉我设置计时器的行,内存使用量保持不变。

As you can see there is nothing done in the method whatsoever - yet the memory usage of the app constantly grows. If I comment out the line where I setup the timer, the memory usage remains the same.

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

Is this a bug in the iOS SDK? Does anyone know a workaround?

推荐答案

这是一个pebkac问题 - 我正在研究仪器中的整体字节,这是一个测量应用程序曾使用的所有内存,而不是衡量当前内存的使用情况。

It's a pebkac issue - I was studying the "Overall Bytes" in Instruments, which is a measure of all memory the app has ever used, rather than a measure of current memory usage.

我仍然很好奇如何衡量应用程序当前的总内存使用量 - 如Live Bytes大概是1.5mb - 即使加载了至少20mb的.pngs。

I'm still curious how to measure the app's current total memory usage - as "Live Bytes" is around 1.5mb - even with at least 20mb of .pngs loaded.

这篇关于NSTimer不间断内存增加 - iOS错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆