iPhone/Objective-C - QuartzCore 库中的内存泄漏

发布于 2024-11-05 07:52:06 字数 285 浏览 2 评论 0原文

我正在运行 Instruments Tool(Leaks),并且在 QuartzCore 库中收到内存泄漏,但不知道代码中的具体位置发生了这种情况。通常我能够查明发生泄漏的线路,但是仪器工具无法让我在任何地方查看此类信息。

在诊断此类泄漏时我还可以考虑哪些其他事项?

在此处输入图像描述

在此输入图像描述

I am running the Instruments Tool (Leaks) and am receiving memory leaks in the QuartzCore library and don't know exactly where in my code this is occurring. Usually I'm able to pin point the line where the leak is occurring, however the instrument tool isn't giving me anywhere to view this type of information.

What would be some other things I could look at in terms of diagnosing such a leak?

enter image description here

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

七婞 2024-11-12 07:52:06

首先,尝试在设备上运行它。有时模拟器会报告设备上不存在的泄漏。

其次,打开堆栈跟踪(右侧栏)并查看您的哪些代码可能涉及触发此调用,然后您可以从那里思考为什么该代码可能会泄漏。

还有一点建议。不要在那里处理泄漏,而是切换到 ObjectAlloc 并使用 Heapshot 功能 - 如果您知道泄漏在哪里,请使用 heapshot 设置基本内存测量,之后每次点击“heapshot”按钮时,您都会查看与您设置的基线的内存“差异”。解决任何过度保留的问题也可能会解决泄漏问题。

First, try running this on the device. Sometimes the simulator will report leaks that do not exist on the device.

Secondly, open up the stack trace (right sidebar) and see what code of yours might be involved higher up in triggering this call, then you can think from there why that code might be leaking.

One additional bit of advice. Instead of playing with leaks there, switch over to ObjectAlloc and use the Heapshot feature - if you know about where the leak is, use the heapshot to set a base memory measurement and every time you hit the "heapshot" button after that you'll see a kind of memory "diff" against that baseline you set. Solving any over-retained problems might also fix your leak.

疧_╮線 2024-11-12 07:52:06

如果您一次仅泄漏 16 个字节,那么它实际上不太可能成为您的应用程序中的问题。如果泄漏发生在系统框架中,则可能不是您的错。

If you’re only leaking 16 bytes at a time, it’s really not likely to become an issue in your app. And if the leak is occurring in a system framework, it probably isn’t your fault.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文