Re: Windows get released on 10.6, leak on 10.7

2011-07-25 Thread Ross Carter
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 
> 
> 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: 0x0014
   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: 
0x002c
   4 Kind: object  rc:   0  Address: 0x01f28db0  Offset: 0x0014  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: 0x0014  Class: 
__NSArrayM
   8 Kind: bytes   rc:   0  Address: 0x01f27d30  Offset: 0x000c
   9 Kind: object  rc:   0  Address: 0x014cda10  Class: CCMCollapsingView  
ivar: NSView._subviews
  10 Kind: object  rc:   0  Address: 0x014c8cb0  Offset: 0x0014  Class: 
__NSArrayM
  11 Kind: bytes   rc:   0  Address: 0x014c9b10  Offset: 0x0008
  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: 0x004c  Class: 
NSKVONotifying_CCMFormatCtl
  15 Kind: object  rc:   0  Address: 0x01824f00  Offset: 0x  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: 0x0014
   1 Kind: bytes   rc:   0  Address: 0x0143ed60  Offset: 0x0014
   2 Kind: object  rc:   0  Address: 0x018df290  Class: CCMTextViewFooter  
ivar: CCMTextViewSection.CCMTextView.NSTextView.NSText._ivars
   3 Kind: object  rc:   0  Address: 0x014b4d70  Offset: 0x0014  Class: 
NSTextViewIvars
   4 Kind: object  rc:   0  Address: 0x018e0fc0  Class: CCMLayoutManager  
Offset: 0x00d8
   5 Kind: object  rc:   0  Address: 0x01827500  Offset: 0x  Class: 
NSKVONotifying_CCMDoc
Root:
   0 Kind: bytes   rc:   1  Address: 0x01443f20  Offset: 0x0014
   1 Kind: bytes   rc:   0  Address: 0x01444500  Offset: 0x0014
   2 Kind: object  rc:   0  Address: 0x018e1d50  Class: CCMTextViewHeader  
ivar: CCMTextViewSection.CCMTextView.NSTextView.NSText._ivars
   3 Kind: object  rc:   0  Address: 0x018f3280  Offset: 0x0014  Class: 
NSTextViewIvars
   4 Kind: object  rc:   0  Address: 0x018e4730  Class: CCMLayoutManager  
Offset: 0x00d8
   5 Kind: object  rc:   0  Address: 0x01827500  Offset: 0x  Class: 
NSKVONotifying_CCMDoc
Root:
   0 Kind: bytes   rc:   1  Address: 0x011ab020  Offset: 0x0014
   1 Kind: bytes   rc:   0  Address: 0x011ac2c0  Offset: 0x0014
   2 Kind: object  rc:   0  Address: 0x01879770  Class: CCMTextViewColumn  
ivar: CCMTextView.NSTextView.NSText._ivars
   3 Kind: object  rc:   0  Address: 0x01853510  Offset: 0x0014  Class: 
NSTextViewIvars
   4 Kind: object  rc:   0  Address: 0x018d7050  Class: CCMColumnLayoutManager  
ivar: CCMLayoutManager
   5 Kind: object  rc:   0  Address: 0x01827500  Offset: 0x  Class: 
NSKVONotifying_CCMDoc
Root:
   0 Kind: bytes   rc:   1  Address: 0x01817670  Offset: 0x0014
   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: 
0x002c
   4 Kind: object  rc:   0  Address: 0x0183ad60  Offset: 0x0014  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: 0x0014  Class: 
__NSArrayM
   8 Kind: bytes   rc:   0  Address: 0x01893110  Offset: 0x000c
   9 Kind: object  rc:   0  Address: 0x014db880  Class: CCMCollapsingView  
ivar: NSView._subviews
  10 Kind: object  rc:   0  Address: 0x014b1cd0  Offset: 0x0014  Class: 
__NSArrayM
  11 Kind: bytes   rc:   0  Address: 0x014b23c0  Offset: 0x0008
  12 Kind: object  rc:   0  Address: 0x01827330  Class: 
CCMUnitTextFieldPointsOnly  ivar: CCMUnitTextField.NSTextField.NSControl
  13 Kin

Re: Windows get released on 10.6, leak on 10.7

2011-07-21 Thread Corbin Dunn

On Jul 21, 2011, at 1:16 PM, Ross Carter wrote:

>> Just a long shot, but does this have anything to do with the new ARC 
>> (Automatic Reference Counting)?
> 
> Joanna: The app uses GC, and was built long before ARC was announced. 
> Everything gets collected on 10.6. I'm puzzled how ARC could affect GC.
> 
> 
>> Have you used Instruments to find out why? If not, then use the object alloc 
>> instrument with reference counting turned on. Then look at your window 
>> objects and try and figure out where the extra retain is happening.
> 
> 
> Nick: It's a GC app, so -retain is a no-op. My Instruments foo is not strong. 
> What tool will show why an object is not getting collected?
> 

Log the address of your object. Then, break in gdb and do:

info gc-roots 

Then see what is rooting it. also, try gc-references in it to see what 
references it, but roots are more important.

corbin

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Windows get released on 10.6, leak on 10.7

2011-07-21 Thread Ross Carter
> Just a long shot, but does this have anything to do with the new ARC 
> (Automatic Reference Counting)?

Joanna: The app uses GC, and was built long before ARC was announced. 
Everything gets collected on 10.6. I'm puzzled how ARC could affect GC.


> Have you used Instruments to find out why? If not, then use the object alloc 
> instrument with reference counting turned on. Then look at your window 
> objects and try and figure out where the extra retain is happening.


Nick: It's a GC app, so -retain is a no-op. My Instruments foo is not strong. 
What tool will show why an object is not getting collected?


> NSDocuments on 10.7 are supposed to be restorable (beyond automatic saving of 
> documents). Could it be linked to that?


vincent: Good idea, but I would expect that restorable documents are saved on 
disk and not retained in memory. 

Ross
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Windows get released on 10.6, leak on 10.7

2011-07-21 Thread vincent habchi
> I'm looking for ideas on what might cause this behavior: an existing app that 
> was compiled with 10.6 SDK runs fine on 10.6 and 10.5. When run on 10.7, 
> document windows (and their window controllers and NSDocuments) do not get 
> released when the window is closed.

NSDocuments on 10.7 are supposed to be restorable (beyond automatic saving of 
documents). Could it be linked to that?

Vincent___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Windows get released on 10.6, leak on 10.7

2011-07-21 Thread Nick Zitzmann

On Jul 21, 2011, at 10:29 AM, Ross Carter wrote:

> I'm looking for ideas on what might cause this behavior: an existing app that 
> was compiled with 10.6 SDK runs fine on 10.6 and 10.5. When run on 10.7, 
> document windows (and their window controllers and NSDocuments) do not get 
> released when the window is closed.
> 
> All thoughts appreciated.

Have you used Instruments to find out why? If not, then use the object alloc 
instrument with reference counting turned on. Then look at your window objects 
and try and figure out where the extra retain is happening.

Nick Zitzmann


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Windows get released on 10.6, leak on 10.7

2011-07-21 Thread Joanna Carter
Le 21 juil. 2011 à 17:29, Ross Carter a écrit :

> I'm looking for ideas on what might cause this behavior: an existing app that 
> was compiled with 10.6 SDK runs fine on 10.6 and 10.5. When run on 10.7, 
> document windows (and their window controllers and NSDocuments) do not get 
> released when the window is closed.
> 
> All thoughts appreciated.

Just a long shot, but does this have anything to do with the new ARC (Automatic 
Reference Counting)?

Joanna

--
Joanna Carter
Carter Consulting

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Windows get released on 10.6, leak on 10.7

2011-07-21 Thread Ross Carter
I'm looking for ideas on what might cause this behavior: an existing app that 
was compiled with 10.6 SDK runs fine on 10.6 and 10.5. When run on 10.7, 
document windows (and their window controllers and NSDocuments) do not get 
released when the window is closed.

All thoughts appreciated.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com