• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Windows get released on 10.6, leak on 10.7
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Windows get released on 10.6, leak on 10.7


  • Subject: Re: Windows get released on 10.6, leak on 10.7
  • From: Ross Carter <email@hidden>
  • Date: Mon, 25 Jul 2011 17:15:35 -0400

On Jul 21, 2011, at 6:40 PM, Corbin Dunn wrote:

> Log the address of your object. Then, break in gdb and do:
>
> info gc-roots <address>
>
> Then see what is rooting it. also, try gc-references in it to see what references it, but roots are more important.

Thanks, Corbin. I'm trying to understand the output of gc-roots. On 10.6, for the NSDocument subclass (CCMDoc) instance I get this:

(gdb) info gc-roots 0x1670a40
Number of roots: 1
Root:
   0 Kind: bytes   rc: -1847835481  Address: 0x01670a40

On 10.7, I get unpredictable results. Sometimes there is one root, and sometimes there are several. Here is a short output:

(gdb) info gc-roots 0x1824f00
Number of roots: 1
Root:
   0 Kind: bytes   rc:   1  Address: 0x011ee790  Offset: 0x00000014
   1 Kind: object  rc:   0  Address: 0x014a65d0  Class: CCMDocumentWindow  ivar: NSWindow.NSResponder
   2 Kind: object  rc:   0  Address: 0x01b11e60  Class: CCMWindowCtl  ivar: _paletteGroups
   3 Kind: object  rc:   0  Address: 0x014d7950  Class: NSView  Offset: 0x0000002c
   4 Kind: object  rc:   0  Address: 0x01f28db0  Offset: 0x00000014  Class: __NSArrayM
   5 Kind: bytes   rc:   0  Address: 0x01f28fa0
   6 Kind: object  rc:   0  Address: 0x018b9490  Class: CCMPaletteGroup  ivar: NSView._subviews
   7 Kind: object  rc:   0  Address: 0x01f1cdb0  Offset: 0x00000014  Class: __NSArrayM
   8 Kind: bytes   rc:   0  Address: 0x01f27d30  Offset: 0x0000000c
   9 Kind: object  rc:   0  Address: 0x014cda10  Class: CCMCollapsingView  ivar: NSView._subviews
  10 Kind: object  rc:   0  Address: 0x014c8cb0  Offset: 0x00000014  Class: __NSArrayM
  11 Kind: bytes   rc:   0  Address: 0x014c9b10  Offset: 0x00000008
  12 Kind: object  rc:   0  Address: 0x014c77f0  Class: CCMUnitTextFieldPointsOnly  ivar: CCMUnitTextField.NSTextField.NSControl
  13 Kind: object  rc:   0  Address: 0x014fcb00  Class: NSTextFieldCell  ivar: NSActionCell
  14 Kind: object  rc:   0  Address: 0x014ea670  Offset: 0x0000004c  Class: NSKVONotifying_CCMFormatCtl
  15 Kind: object  rc:   0  Address: 0x01824f00  Offset: 0x00000000  Class: NSKVONotifying_CCMDoc

and here is a long one:

(gdb) info gc-roots 0x1827500
Number of roots: 5
Root:
   0 Kind: bytes   rc:   1  Address: 0x0143ec20  Offset: 0x00000014
   1 Kind: bytes   rc:   0  Address: 0x0143ed60  Offset: 0x00000014
   2 Kind: object  rc:   0  Address: 0x018df290  Class: CCMTextViewFooter  ivar: CCMTextViewSection.CCMTextView.NSTextView.NSText._ivars
   3 Kind: object  rc:   0  Address: 0x014b4d70  Offset: 0x00000014  Class: NSTextViewIvars
   4 Kind: object  rc:   0  Address: 0x018e0fc0  Class: CCMLayoutManager  Offset: 0x000000d8
   5 Kind: object  rc:   0  Address: 0x01827500  Offset: 0x00000000  Class: NSKVONotifying_CCMDoc
Root:
   0 Kind: bytes   rc:   1  Address: 0x01443f20  Offset: 0x00000014
   1 Kind: bytes   rc:   0  Address: 0x01444500  Offset: 0x00000014
   2 Kind: object  rc:   0  Address: 0x018e1d50  Class: CCMTextViewHeader  ivar: CCMTextViewSection.CCMTextView.NSTextView.NSText._ivars
   3 Kind: object  rc:   0  Address: 0x018f3280  Offset: 0x00000014  Class: NSTextViewIvars
   4 Kind: object  rc:   0  Address: 0x018e4730  Class: CCMLayoutManager  Offset: 0x000000d8
   5 Kind: object  rc:   0  Address: 0x01827500  Offset: 0x00000000  Class: NSKVONotifying_CCMDoc
Root:
   0 Kind: bytes   rc:   1  Address: 0x011ab020  Offset: 0x00000014
   1 Kind: bytes   rc:   0  Address: 0x011ac2c0  Offset: 0x00000014
   2 Kind: object  rc:   0  Address: 0x01879770  Class: CCMTextViewColumn  ivar: CCMTextView.NSTextView.NSText._ivars
   3 Kind: object  rc:   0  Address: 0x01853510  Offset: 0x00000014  Class: NSTextViewIvars
   4 Kind: object  rc:   0  Address: 0x018d7050  Class: CCMColumnLayoutManager  ivar: CCMLayoutManager
   5 Kind: object  rc:   0  Address: 0x01827500  Offset: 0x00000000  Class: NSKVONotifying_CCMDoc
Root:
   0 Kind: bytes   rc:   1  Address: 0x01817670  Offset: 0x00000014
   1 Kind: object  rc:   0  Address: 0x0182a9a0  Class: CCMDocumentWindow  ivar: NSWindow.NSResponder
   2 Kind: object  rc:   0  Address: 0x018321b0  Class: CCMWindowCtl  ivar: _paletteGroups
   3 Kind: object  rc:   0  Address: 0x01816fb0  Class: NSView  Offset: 0x0000002c
   4 Kind: object  rc:   0  Address: 0x0183ad60  Offset: 0x00000014  Class: __NSArrayM
   5 Kind: bytes   rc:   0  Address: 0x018760d0
   6 Kind: object  rc:   0  Address: 0x01853a00  Class: CCMPaletteGroup  ivar: NSView._subviews
   7 Kind: object  rc:   0  Address: 0x014f6100  Offset: 0x00000014  Class: __NSArrayM
   8 Kind: bytes   rc:   0  Address: 0x01893110  Offset: 0x0000000c
   9 Kind: object  rc:   0  Address: 0x014db880  Class: CCMCollapsingView  ivar: NSView._subviews
  10 Kind: object  rc:   0  Address: 0x014b1cd0  Offset: 0x00000014  Class: __NSArrayM
  11 Kind: bytes   rc:   0  Address: 0x014b23c0  Offset: 0x00000008
  12 Kind: object  rc:   0  Address: 0x01827330  Class: CCMUnitTextFieldPointsOnly  ivar: CCMUnitTextField.NSTextField.NSControl
  13 Kind: object  rc:   0  Address: 0x014e8520  Class: NSTextFieldCell  ivar: NSActionCell
  14 Kind: object  rc:   0  Address: 0x0182f5d0  Offset: 0x0000004c  Class: NSKVONotifying_CCMFormatCtl
  15 Kind: object  rc:   0  Address: 0x01827500  Offset: 0x00000000  Class: NSKVONotifying_CCMDoc
Root:
   0 Kind: bytes   rc:   1  Address: 0x014888b0  Offset: 0x00000014
   1 Kind: object  rc:   0  Address: 0x0182a9a0  Class: CCMDocumentWindow  ivar: NSWindow.NSResponder
   2 Kind: object  rc:   0  Address: 0x018321b0  Class: CCMWindowCtl  ivar: _paletteGroups
   3 Kind: object  rc:   0  Address: 0x01816fb0  Class: NSView  Offset: 0x0000002c
   4 Kind: object  rc:   0  Address: 0x0183ad60  Offset: 0x00000014  Class: __NSArrayM
   5 Kind: bytes   rc:   0  Address: 0x018760d0
   6 Kind: object  rc:   0  Address: 0x01853a00  Class: CCMPaletteGroup  ivar: NSView._subviews
   7 Kind: object  rc:   0  Address: 0x014f6100  Offset: 0x00000014  Class: __NSArrayM
   8 Kind: bytes   rc:   0  Address: 0x01893110  Offset: 0x0000000c
   9 Kind: object  rc:   0  Address: 0x014db880  Class: CCMCollapsingView  ivar: NSView._subviews
  10 Kind: object  rc:   0  Address: 0x014b1cd0  Offset: 0x00000014  Class: __NSArrayM
  11 Kind: bytes   rc:   0  Address: 0x014b23c0  Offset: 0x00000008
  12 Kind: object  rc:   0  Address: 0x01827330  Class: CCMUnitTextFieldPointsOnly  ivar: CCMUnitTextField.NSTextField.NSControl
  13 Kind: object  rc:   0  Address: 0x014e8520  Class: NSTextFieldCell  ivar: NSActionCell
  14 Kind: object  rc:   0  Address: 0x0182f5d0  Offset: 0x0000004c  Class: NSKVONotifying_CCMFormatCtl
  15 Kind: object  rc:   0  Address: 0x01827500  Offset: 0x00000000  Class: NSKVONotifying_CCMDoc


Looking at the short example, can you tell me what it is saying? My guess is that the output says, "Deep in the window's view hierarchy there is a cell that is bound to CCMFormatCtl which in turn is bound to your CCMDoc instance."

So I comment out the line that creates the CCMFormatCtl instance, run the app again, close the window, and I get this:

(gdb) info gcc-roots 0x1817360
Number of roots:0

But the document still does not get collected. Its -finalize method does not fire.

All words of wisdom are appreciated. I try to use a tech support incident on this, but it came back with a request to file a bug report instead.

Ross
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Windows get released on 10.6, leak on 10.7 (From: Ross Carter <email@hidden>)
 >Re: Windows get released on 10.6, leak on 10.7 (From: vincent habchi <email@hidden>)
 >Re: Windows get released on 10.6, leak on 10.7 (From: Ross Carter <email@hidden>)
 >Re: Windows get released on 10.6, leak on 10.7 (From: Corbin Dunn <email@hidden>)

  • Prev by Date: Re: Problem in coming out of modal run loop
  • Next by Date: How do I update re-sort the fetch results associated with an NSFetchedResultsController instance?
  • Previous by thread: Re: Windows get released on 10.6, leak on 10.7
  • Next by thread: Timing some code execution outside Instruments
  • Index(es):
    • Date
    • Thread