Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 分析僵尸_Iphone_Objective C_Memory Management_Calayer_Nszombie - Fatal编程技术网

Iphone 分析僵尸

Iphone 分析僵尸,iphone,objective-c,memory-management,calayer,nszombie,Iphone,Objective C,Memory Management,Calayer,Nszombie,我一直得到错误的指令或错误的异常,所以我启用了NSZombieEnabled和其他需要的变量,我不知道如何分析结果。以下是记录的内容: ToDoWall(1634) malloc: recording malloc stacks to disk using standard recorder ToDoWall(1634) malloc: stack logging compaction turned off; size of log files on disk can increase rapi

我一直得到错误的指令或错误的异常,所以我启用了NSZombieEnabled和其他需要的变量,我不知道如何分析结果。以下是记录的内容:

ToDoWall(1634) malloc: recording malloc stacks to disk using standard recorder
ToDoWall(1634) malloc: stack logging compaction turned off; size of log files on disk can increase rapidly
ToDoWall(1634) malloc: process 1623 no longer exists, stack logs deleted from /tmp/stack-logs.1623.ToDoWall.iCfMUD.index
ToDoWall(1634) malloc: stack logs being written into /tmp/stack-logs.1634.ToDoWall.8UpPt8.index
2010-07-06 13:25:47.018 ToDoWall[1634:207] *** -[CALayer release]: message sent to deallocated instance 0x39361c0

(gdb) shell malloc_history 1634 0x39361c0

ALLOC 0x39361c0-0x39361df [size=32]: thread_a06c9500 |start | main | UIApplicationMain | -[UIApplication _run] | CFRunLoopRunInMode | CFRunLoopRunSpecific | PurpleEventCallback | _UIApplicationHandleEvent | -[UIApplication sendEvent:] | -[UIApplication handleEvent:withNewEvent:] | -[UIApplication _reportAppLaunchFinished] | CA::Transaction::commit() | CA::Context::commit_transaction(CA::Transaction*) | CALayerDisplayIfNeeded | -[CALayer _display] | CABackingStoreUpdate | backing_callback(CGContext*, void*) | -[CALayer drawInContext:] | -[UIView(CALayerDelegate) drawLayer:inContext:] | -[UINavigationItemView drawRect:] | -[UINavigationItemView drawText:inRect:] | -[NSString(UIStringDrawing) drawAtPoint:forWidth:withFont:lineBreakMode:] | -[NSString(UIStringDrawing) drawAtPoint:forWidth:withFont:lineBreakMode:letterSpacing:includeEmoji:] | -[NSString(WebStringDrawing) _web_drawAtPoint:forWidth:withFont:ellipsis:letterSpacing:includeEmoji:] | drawAtPoint(WebCore::String const&, WebCore::FloatPoint const&, WebCore::Font const&, WebCore::GraphicsContext*, WebCore::BidiStatus*, int) | WebCore::Font::drawSimpleText(WebCore::GraphicsContext*, WebCore::TextRun const&, WebCore::FloatPoint const&, int, int) const | WebCore::Font::drawGlyphBuffer(WebCore::GraphicsContext*, WebCore::GlyphBuffer const&, WebCore::TextRun const&, WebCore::FloatPoint&) const | WebCore::Font::drawGlyphs(WebCore::GraphicsContext*, WebCore::SimpleFontData const*, WebCore::GlyphBuffer const&, int, int, WebCore::FloatPoint const&, bool) const | CGContextShowGlyphsWithAdvances | draw_glyphs | ripc_DrawGlyphs | ripc_RenderGlyphs | CGGlyphLockUnlock | add_bitmaps_to_cache | CGFontCacheSetValues | CGFontCacheSetValue | calloc | malloc_zone_calloc 
----
FREE  0x39361c0-0x39361df [size=32]: thread_a06c9500 |start | main | UIApplicationMain | GSEventRun | GSEventRunModal | CFRunLoopRunInMode | CFRunLoopRunSpecific | __CFRunLoopDoObservers | CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) | CA::Transaction::commit() | CA::Context::commit_transaction(CA::Transaction*) | CALayerDisplayIfNeeded | -[CALayer _display] | CABackingStoreUpdate | backing_callback(CGContext*, void*) | -[CALayer drawInContext:] | -[UIView(CALayerDelegate) drawLayer:inContext:] | -[UILabel drawTextInRect:] | -[UILabel _drawTextInRect:baselineCalculationOnly:] | -[NSString(UIStringDrawing) drawAtPoint:forWidth:withFont:lineBreakMode:] | -[NSString(UIStringDrawing) drawAtPoint:forWidth:withFont:lineBreakMode:letterSpacing:includeEmoji:] | -[NSString(WebStringDrawing) _web_drawAtPoint:forWidth:withFont:ellipsis:letterSpacing:includeEmoji:] | drawAtPoint(WebCore::String const&, WebCore::FloatPoint const&, WebCore::Font const&, WebCore::GraphicsContext*, WebCore::BidiStatus*, int) | WebCore::Font::drawSimpleText(WebCore::GraphicsContext*, WebCore::TextRun const&, WebCore::FloatPoint const&, int, int) const | WebCore::Font::drawGlyphBuffer(WebCore::GraphicsContext*, WebCore::GlyphBuffer const&, WebCore::TextRun const&, WebCore::FloatPoint&) const | WebCore::Font::drawGlyphs(WebCore::GraphicsContext*, WebCore::SimpleFontData const*, WebCore::GlyphBuffer const&, int, int, WebCore::FloatPoint const&, bool) const | CGContextShowGlyphsWithAdvances | draw_glyphs | ripc_DrawGlyphs | ripc_RenderGlyphs | CGGlyphLockUnlock | CGFontCacheUnlock | expire_glyphs_nl | evict_glyph_entry_from_cache | free 

ALLOC 0x39361c0-0x39361ef [size=48]: thread_a06c9500 |start | main | UIApplicationMain | GSEventRun | GSEventRunModal | CFRunLoopRunInMode | CFRunLoopRunSpecific | PurpleEventCallback | _UIApplicationHandleEvent | -[UIApplication sendEvent:] | -[UIWindow _sendTouchesForEvent:] | -[UIControl touchesEnded:withEvent:] | -[UIControl(Internal) _sendActionsForEvents:withEvent:] | -[UIControl sendAction:to:forEvent:] | -[UIApplication sendAction:to:from:forEvent:] | -[RootViewController changeFont] | -[UINavigationController pushViewController:animated:] | -[UINavigationController pushViewController:transition:forceImmediate:] | -[UINavigationController _startDeferredTransitionIfNeeded] | -[UINavigationController _startTransition:fromViewController:toViewController:] | -[UINavigationController _layoutViewController:] | -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] | -[UIViewController contentScrollView] | -[UIViewController view] | -[UIViewController loadView] | -[UIViewController _loadViewFromNibNamed:bundle:] | -[NSBundle(NSBundleAdditions) loadNibNamed:owner:options:] | -[UINib instantiateWithOptions:owner:loadingResourcesFromBundle:] | _decodeObject | _decodeObjectBinary | -[NSArray(NSArray) initWithCoder:] | -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] | _decodeObjectBinary | -[UIRuntimeConnection initWithCoder:] | _decodeObject | _decodeObjectBinary | -[UITextView initWithCoder:] | -[UIScrollView initWithCoder:] | -[UIView initWithCoder:] | UIViewCommonInitWithFrame | -[UIView _createLayerWithFrame:] | +[NSObject alloc] | +[NSObject allocWithZone:] | _internal_class_createInstance | _internal_class_createInstanceFromZone | calloc | malloc_zone_calloc 
更新:

我想我找到了问题的根源

- (IBAction)changeBackground {
    BackgroundTableViewController *viewController = [[BackgroundTableViewController alloc] init];
    NSLog(@"%d",[viewController retainCount]);
    [viewController setTitle:@"Change Background"];
    NSLog(@"%d",[viewController retainCount]);
    [[self navigationController] pushViewController:viewController animated:YES];
    NSLog(@"%d",[viewController retainCount]);
    [viewController release];
    NSLog(@"%d",[viewController retainCount]);
}
重新计数记录为:1 5 4

我不明白为什么每次按下viewController都会将重新计数跳到5=\

问题是您正在发布一个尚未保留的
CALayer

如果没有代码摘录,我将无法进一步帮助您。

所有

问题是您正在发布一个尚未保留的
CALayer


如果没有代码摘录,我将无法进一步帮助您。

2010-07-06 13:25:47.018 ToDoWall[1634:207]***-[CALayer release]:发送到已解除分配实例0x39361c0的消息告诉您从何处开始查找。听起来您正在释放一个已保留计数为0的对象(即,它已被释放)。快速规则:以及更深入的文章:此外,您可能希望添加更多有关加载视图后发生的事情的详细信息(例如,您在屏幕上绘制的是什么,您尝试的是什么动画,等等?)不要担心保留计数会升得这么高。我们不知道调用pushViewController:animated:时发生了什么;我们只需要相信它最终会进行适当的内存管理。另一方面,如果保留计数下降,我可能会担心。永远不要使用
retainCount
。它的结果往往具有误导性。使用Instruments的Allocations instrument,它使您能够查看任何对象的真实历史。
2010-07-06 13:25:47.018 ToDoWall[1634:207]***-[CALayer release]:发送到解除分配实例0x39361c0的消息
它告诉您从何处开始查找。听起来您正在释放一个已保留计数为0的对象(即,它已被释放)。快速规则:以及更深入的文章:此外,您可能希望添加更多有关加载视图后发生的事情的详细信息(例如,您在屏幕上绘制的是什么,您尝试的是什么动画,等等?)不要担心保留计数会升得这么高。我们不知道调用pushViewController:animated:时发生了什么;我们只需要相信它最终会进行适当的内存管理。另一方面,如果保留计数下降,我可能会担心。永远不要使用
retainCount
。它的结果往往具有误导性。使用Instruments的Allocations instrument,使您能够查看任何对象的真实历史。Core动画层。看起来你肯定要发布两次。当你从导航控制器弹出视图时,你不需要释放它,它会为你做的。核心动画层。看起来你肯定要发布两次。当你从导航控制器弹出视图时,你不需要释放它——它会为你做的。