iOS libsystem_c.dylib strdup 内存泄漏 NSZombie 不工作

发布于 2024-11-05 10:08:11 字数 657 浏览 8 评论 0原文

请帮我找出 iOS 内存泄漏问题。谢谢!

我正在使用 xCode 4.0.1,我尝试激活 NSZombie 来跟踪内存泄漏,但它似乎不像以前那样工作,使用 xCode 3.x

我无法找出内存泄漏来自哪里,正如 Instruments 指出的那样:

Leaked Object -> GeneralBlock-32 地址-> 0x4c8600 尺寸-> 32字节 负责任的图书馆-> libsystem_c.dylib 负责框架/调用者 -> strup

此时我不知道我是否在 xCode 4 中以正确的方式将 Instruments 与 NSZombie 一起使用,因为当我单击时它不会显示 NSZombie 选项“i”了解更多信息,位于左侧选项泄漏下。

观察:我的 iPhone 应用程序在有限的时间内播放实时流 mms/wma 以及 wma audio 文件。泄漏发生在有限的 wma 文件中,但当我从流媒体源播放时运行完美,没有结束时间。

Please help me track down an iOS memory leak. Thanks!

I'm using xCode 4.0.1 and I tried to activate NSZombie to track a memory leak, but it doesn't seems to work as before, with xCode 3.x

I can't find out where the memory leak is coming from, as Instruments points this out:

Leaked Object -> GeneralBlock-32
Address -> 0x4c8600
Size -> 32 Bytes
Responsible Library -> libsystem_c.dylib
Responsible Frame/Caller -> strup

At this point I don't know If I'm using Instruments with NSZombie the right way with xCode 4, as it doesn't show the NSZombie option when I click "i" for more information, under the left option Leaks.

OBSERVATION: My iPhone application plays a live stream mms/wma and also wma áudio files with a finite amount of time. The leak happens only with a finite wma file, but runs perfectly when I'm playing from a streamed source, with no ending time.

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

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

发布评论

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

评论(2

娜些时光,永不杰束 2024-11-12 10:08:11

首先,这是一个 malloc 块,而不是一个对象。僵尸将不起作用(并且在以前的版本中也永远不会起作用)。

这种泄漏发生了多少次?一次?别担心。每个流一次?提交一个错误——从您到目前为止发布的内容来看,该错误不在您的代码中(除非您的代码正在调用 strdup,这当然是可能的,但在大多数不重的 iOS 应用程序中是不常见的使用第三方库...是吗?)

在任何情况下,除非它在应用程序运行时泄漏数百个和数百个 32 字节分配,否则不要担心(但请提交错误)。

正如 Valkio 所说,您可以直接从 gdb (或 Instruments)获取分配的堆栈跟踪。

First, that is a malloc block, not an object. Zombies won't work (and would never have worked in prior versions either).

How many times does that leak happen? Once? Don't worry about it. Once per stream? file a bug -- that isn't in your code from what you have posted so far (unless your code is calling strdup, which is certainly possible but atypical in most iOS apps that aren't making heavy use of third party libraries... are you?)

In any case, unless it is leaking 100s and 100s of 32 byte allocations across the runtime of your app, don't worry about it (but please do file a bug).

As Valkio said, you can grab the stack trace of the allocation from gdb (or from Instruments) directly.

微凉 2024-11-12 10:08:11

如果执行以下操作,您可以看到它的分配位置:

  1. 转到产品 ->编辑方案->跑步
    (调试)->论据。
  2. 将其添加到环境变量中: MallocStackLoggingNoCompact
  3. 将其设置为 YES
  4. 运行,并让它崩溃。
  5. 输入 console (gdb) info malloc 0x4c8600 或任何地址。

You can see where it was allocated if you do this:

  1. Go to Product -> Edit Scheme -> Run
    (Debug) -> Arguments.
  2. Add this to environment variables: MallocStackLoggingNoCompact
  3. Set it to YES
  4. Run, and let it crash.
  5. type in console (gdb) info malloc 0x4c8600 or whatever the address is.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文