【问题标题】:Instruments and leaks仪器和泄漏
【发布时间】:2011-07-11 07:49:38
【问题描述】:

我正在测试我的应用程序,我不断收到这些泄漏,但我的代码中没有一个。我想,还有其他人遇到这些问题吗?

__NSCFDictionary        0x5f8cfe0   48  AudioToolbox    SimAggregateDevice::SimAggregateDevice(__CFString const*, __CFString const*, long&)

Malloc 32 Bytes     0x5f83a00   32  AudioToolbox    SimAggregateDevice::SimAggregateDevice(__CFString const*, __CFString const*, long&)

Malloc 48 Bytes     0x5f839d0   48  AudioToolbox    SimAggregateDevice::SimAggregateDevice(__CFString const*, __CFString const*, long&)

Malloc 32 Bytes     0x5f839b0   32  AudioToolbox    CreateDictionaryForDevice(unsigned long)

Malloc 32 Bytes     0x5f83990   32  AudioToolbox    CreateDictionaryForDevice(unsigned long)
__NSCFDictionary        0x5f83960   48  AudioToolbox    CreateDictionaryForDevice(unsigned long)

Malloc 32 Bytes     0x5f83940   32  AudioToolbox    SimAggregateDevice::SimAggregateDevice(__CFString const*, __CFString const*, long&)

__NSCFArray     0x5f838b0   32  AudioToolbox    SimAggregateDevice::SimAggregateDevice(__CFString const*, __CFString const*, long&)

任何帮助都会很棒,感谢...是的...新手。

【问题讨论】:

  • 你能发布更多信息吗?可能是那些 NSStrings 或 CFDictionary 没有正确发布。当您深入到特定的 HEX 地址时,您可以看到内存何时分配、初始化、保留、释放和解除分配的完整跟踪
  • 更多信息在这里会很有帮助。就像你的代码试图做的那样,代码 sn-ps,任何东西。你没有给我们太多的合作机会。
  • WWDC10 视频包括有关 Instruments 和其他开发人员工具的多个会议developer.apple.com/videos/wwdc/2010
  • @slf 我在 UIScrollview 中使用 MPMovieplayerViewController,当我运行其中一个视频时,我得到了这个泄漏。也许我没有正确释放它或根本没有? -(IBAction)shimmyVideo:(id)sender { NSString url = @"andalee.com/iPhoneVideos/MeDrumming.MP4"; MPMoviePlayerViewController moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:url]]; [self presentMoviePlayerViewControllerAnimated:moviePlayer]; } @brenton 我需要释放字符串“url”吗?
  • 你可以在这里发布一些sn-ps或使用pastie.orggist.github.com cmets部分很难调试

标签: iphone debugging ios memory-leaks instruments


【解决方案1】:

还可以尝试静态分析构建。这通常会揭示保留/释放不匹配和一般泄漏。您可以使用 Cmd+Shift+A 运行它(我认为)。

【讨论】:

  • 当我运行分析构建时,它运行良好,没有泄漏或错误。
【解决方案2】:

首先,我认为您是在模拟器上运行您的应用程序 - 您不应该这样做。

或者更确切地说,永远不要使用模拟器来测试内存分配、泄漏等。您应该始终在设备本身上运行它。

我认为,如果您在设备上运行它,您仍然会看到此泄漏(嗯,您会看到类似的内容),如果您使用 Google 搜索您要返回的各种内容,您会看到其他人遇到此问题.框架本身似乎存在一些小漏洞,这是您无法控制的。我就不管他们了。

【讨论】:

  • 是的,我在模拟器中进行了大部分测试,但我已经在设备上运行了它,似乎我得到了同样的结果。
猜你喜欢
  • 2011-11-02
  • 2011-06-18
  • 2023-03-18
  • 2012-07-06
  • 2011-10-14
  • 1970-01-01
  • 1970-01-01
  • 2011-02-15
相关资源
最近更新 更多