2010-07-06 8 views
0

Je reçois toujours une mauvaise instruction ou une mauvaise exception, donc j'ai activé NSZombieEnabled et les autres variables nécessaires, et je n'ai aucune idée de comment analyser les résultats. C'est ce qui a été enregistré:Analyser NSZombie

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 

MISE À JOUR:

Je pense avoir trouvé la source du problème.

- (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]); 
} 

Les retainCounts sont enregistrés comme: 1 1 5 4

Je ne comprends pas pourquoi pousser le viewController saute le retainCount jusqu'à 5 = \

+0

'2010-07-06 13: 25: 47.018 ToDoWall [1634: 207] *** - [Libération CALayer]: message envoyé à l'instance désaffectée 0x39361c0' il vous dit où commencer à chercher. On dirait que vous libérez un objet qui a déjà un compte de retenue de 0 (c'est-à-dire qu'il a déjà été désalloué). Règles rapides: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html#//apple_ref/doc/uid/20000994-BAJHFBGH et plus d'article: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html – iwasrobbed

+0

En outre, vous voudrez peut-être ajouter plus de détails sur ce qui se passe après que votre vue se charge (c'est-à-dire que dessinez-vous à l'écran, quelles animations essayez-vous, etc.?) – iwasrobbed

+0

Ne vous inquiétez pas si le nombre de retenues augmente si haut. Nous ne savons pas ce qui se passe quand pushViewController: animated: s'appelle; nous avons juste besoin de croire qu'il fait la gestion de la mémoire appropriée sur sa fin. Si le nombre de gardes avait diminué, d'un autre côté, je pourrais être inquiet. –

Répondre

3

Tous les "malloc: ..." statements appear to be fine.

Le problème est que vous publiez un CALayer qui n'a pas été conservé. Read up on memory management in Cocoa.

Sans un extrait de code, je ne peux pas vous aider davantage.

+0

Qu'est-ce qu'un CALayer? – Kurbz

+0

Core Animation Layer. http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/ProvidingCALayerContent.html Il semble que vous libérez quelque chose deux fois. Lorsque vous affichez la vue depuis le contrôleur de navigation, vous n'avez pas besoin de le relâcher - il le fera pour vous. –