我正在开发Cocoa应用程序,在用Xcode运行我的应用程序时,经常会在调试控制台中得到以下消息:
<My app name>(952,0xb0103000) malloc: free_garbage:垃圾桶ptr = 0x107b2f0,具有非零重计数=1。
我打开了MallocStackLogging和NSZombieEnabled,并在其中几个地址上做了一个malloc_history,并得到了下面引用的跟踪信息。
在所有带错误的块中,公共线程似乎是对NSPopupButtonCell的引用。
我的猜测是,它是对某个地方的CFRetained,但没有释放或使垃圾收集。
( A)这更可能是我的编程错误,还是框架中还没有对GC进行适当更新的错误?
( B)引发这一信息的问题的后果是什么?也就是说,我是否需要关注这条信息,还是我可以忽略它?
Call 2:Call 2: thread_a003d720、start、NSApplicationMain、main、NSApplicationMain、-NSApplication、run、-NSApplication、_DPSNextEvent、_DPSNextEvent、BlockUntilNextEventMatchingListInMode、RunCurrentEventLoopInMode、CFRunLoopRunInMode、__CFRunLoopDoObservers、En1#、#en23、#en2、#en2、_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:-NSView -NSView -NSView _drawRect:clip: en22 drawWithFrame:inView: inView:AC.26 -NSPopUpButtonCell _drawIndicatorWithFrame:inView: en22 _indicatorFrameForCellFrame:inView: en22_drawIndicatorWithFrame:inView:en22 19 en22 21 en22 +NSImage:+NSImage:+NSImage::Copy度量值( _coreUIImageWithBaseName:state:backgroundStyle:,CGRect,CGContext*,__CFDictionary const*,__CFArray const*) __CFArray const*:CopyImage测量误差(long,CUIContext const*,__CFArray const*,__CFDictionary*) x CreateImageSourceFromDisk(long,CUIContext const*,long*,未签名char*) \x{e76f}\x{e76f}\x{e76f
发布于 2009-04-30 00:56:02
它实际上位于Xcode使用的低级框架中,任何使用NSImage的垃圾收集应用程序都会生成同样(无害但烦人)的消息。
让这些声音安静下来的一种方法是:http://0xced.blogspot.com/2008/09/quietxcode.html
发布于 2009-04-29 19:04:33
我一直在用Xcode看到这个。这是Xcode本身的内存管理问题,与程序无关。
如果这些错误与您的程序相关,它们将显示在调试窗口(当您按shift-命令-r时显示的)以及系统控制台中。
这些Xcode malloc消息只出现在系统控制台中,所以它们不是您的问题。
现在,苹果发布了一个IDE,将大量内存错误日志转储到系统控制台?这可能是要担心的事情:)
https://stackoverflow.com/questions/803643
复制相似问题