iPhone内存,该相信什么?
我在使用某个应用程序时遇到了一些内存问题。我现在已经到了一个阶段,在记忆方面没有什么能真正给我一个可靠的答案。
起初我使用了分配分析器,我认为它似乎工作得不太好,我认为这是因为我的大部分代码都是用 Obj-C++ 编写的,这意味着它无法正确跟踪内存。
通过分配分析器,它告诉我该应用程序使用了 32mb 内存,在这一点上它说它内存不足,有时会崩溃。然而,在应用程序的其他部分,它使用了多达 40mb 并且从未崩溃。
我找到了这个代码块:
http://landonf.bikemonkey.org/code/iphone /Determining_Available_Memory.20081203.html
这似乎告诉我我使用了 70mb内存,当我收到内存不足警告时,它说我还有 2mb - 4mb 未使用的内存。这看起来更合理,但它几乎是分析器所说的两倍!
我唯一能想到的就是忽略这一切并尽可能减少我的应用程序使用的内存量。
I have been having some memory problems with an app. Im getting to a stage now where nothing really gives me a solid answer in terms of memory.
At first I used the Allocations profiler which I dont think seems to work that well at all, I think this is due to the fact most of my code is in Obj-C++ meaning it cant track the memory correctly.
With the Allocations profiler it tells me the app uses 32mb of memory and around this point it says it has low memory and sometimes crashes out. However, within other parts of the applications its used up to 40mb and never crashed out.
I found this code chunk:
http://landonf.bikemonkey.org/code/iphone/Determining_Available_Memory.20081203.html
Which appears to tell me im using 70mb of memory, when I get the low memory warning it says I have 2mb - 4mb left of unused memory. Which seems more reasonable, but its almost double what the profiler says!
The only thing I can think of is just ignoring it all and reducing the amount of memory used by my app as much as possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
忽略这一切并减小应用程序的大小实际上是一个好方法。确保您通过清除内存中不需要的任何内容来响应内存警告。请记住,不同的设备具有不同的内存量,您可能需要使用比您想象的更少的内存,至少如果您想支持那些旧设备的话。
Ignore it all and reduce the size of your app is actually a good way to proceed. Make sure that you're responding to memory warnings by purging anything in memory that you don't need. Remember that different devices have different amounts of memory, and you may need to use even less than you think, at least if you want to support those older devices.