是否可以在启用断点的情况下使用 XCode 的 Instruments?

发布于 2024-12-12 23:54:06 字数 225 浏览 1 评论 0原文

我正在尝试优化 iOS 应用程序的内存使用情况,并且我想查看应用程序在代码中特定点的总内存使用情况。我想我应该能够设置断点,使用活动监视器分析应用程序,然后查看每个断点捕获时的内存使用情况。但是当我运行 Instruments 时,断点似乎不再停止执行,因此很难准确知道内存使用情况何时发生变化。

是否可以同时使用断点和仪器?如果没有,是否有一种巧妙的方法可以编写一些代码,以便在发生特定事件时将标记插入到仪器时间线中?

I'm trying to optimize the memory usage of an iOS app, and I'd like to see what the app's total memory usage is at specific points in the code. I was thinking I should be able to set breakpoints, profile the app with Activity Monitor, and just look at the memory use when each breakpoint catches. But when I run Instruments, it seems breakpoints no longer stop execution, so it's hard to know exactly when memory usage is changing.

Is it possible to use breakpoints and Instruments at the same time? If not, is there a clever way of writing some code to insert a marker into the Instruments timeline when specific events occur?

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

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

发布评论

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

评论(2

惜醉颜 2024-12-19 23:54:06

我今天也遇到了这个问题,经过一番搜索后找到了解决方案。以下文字摘自该帖子:

断点不会中断。仪器利用来自
但是,您的调试版本不会在您设置的断点处停止。
这是因为当您将应用程序加载到
仪器来自 XCode 中的菜单,仪器仅使用路径
当前可执行文件作为其起始路径并从外部加载
来自 XCode。 XCode 中的菜单确实很方便
机制。这不是什么大问题,因为您始终可以在调试中再次运行
如果您需要应用程序,仪器会话后的模式
打破。这只是需要记下的事情。

NSLog 语句不会显示在调试器控制台中。如果您想
查看您的 NSLog 语句,您将需要加载系统控制台
应用程序(/Applications/Utilities/Console)。

参考:http://www.cimgf.com/2008 /04/02/cocoa-tutorial-fixing-memory-leaks-with-instruments/

I also ran into this issue today, and after a bit of searching I found this solution. Text below is a quote from the post:

Breakpoints Do Not Break. Instruments utilizes debug information from
your debug build, however, it does not stop at break points you set.
This is because while you are loading your application into
Instruments from the menu in XCode, Instruments simply uses the path
of the current executable as its start path and loads it externally
from XCode. The menu in XCode is really there as a convenience
mechanism. This is not a big deal as you can always run again in Debug
mode after your instruments session should you want your application
to break. It’s just something to make a note of.

NSLog Statements Do Not Show In The Debugger Console. If you want to
see your NSLog statements, you will need to load the system Console
application (/Applications/Utilities/Console).

Reference: http://www.cimgf.com/2008/04/02/cocoa-tutorial-fixing-memory-leaks-with-instruments/

塔塔猫 2024-12-19 23:54:06

嗯,您没有在调试器的控制下运行。

一种方法可能是在关键点添加警报,然后(手动)进行统计。

或者可能有一些 dtrace 魔法。

Well, you aren't running under control of the debugger.

One approach might be to add alerts at the key points, and take a heapshot then (manually).

Or there may be some dtrace wizardry.

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