On 2013 Jul 19, at 23:59, Kyle Sluder <[email protected]> wrote:

> This method does not exist. In fact, as far as I can tell, there are no
> initializers for __NSCFString *at all*:

Thank you, Kyle.  Yes, I see the NSString documentation also mentions that it 
has "no designated initializer".

> your approach does not sound like the most efficient way to debug your actual 
> problem, which is far more likely that someone is holding on to your NSURL 
> object longer than they should be.

Indeed, that's what I'm looking for.  It's apparently not obvious though, 
because this manual-retain/release project passes the clang static analyzer 
with 0 warnings.

> Have you tried running under the Allocations instrument?

No, I'll study that.  I'd thought that Leaks would be better because it filters 
allocations to show only leaked allocations, whereas Allocations shows the 
whole fire-hose.

I'd thought that watching for an NSString to be initialized to the value of the 
leaked string would be a neat trick.  Simple idea, but maybe it's not do-able, 
due to the opacity of that class cluster machinery.

* * *

Unfortunately, it does look like I need to find that string, because I can't 
find it in a URL.  Here is why I thought it was part of a URL…

leaks Report Version:  2.0
Process 34235: 105989 nodes malloced for 11852 KB
Process 34235: 6 leaks for 352 total leaked bytes.

Leak: 0x1051bac30  size=64  zone: DefaultMallocZone_0x100703000   __NSCFString  
ObjC  CoreFoundation  "file://localhost/Applications/Safari.app/"

Leak: 0x1051bac70  size=64  zone: DefaultMallocZone_0x100703000   NSURL  ObjC  
CoreFoundation
        0x7cc78fa0 0x00007fff 0x00001d80 0x00000001     ...|............
        0x6005d829 0x08000100 0x051bac30 0x00000001     )..`....0.......
        0x00000000 0x00000000 0x051ba950 0x00000001     ........P.......
        0x00000000 0x00000000 0x00000000 0x00000000     ................
...

You see two leaks, a __NSCFString whose value is 
"file://localhost/Applications/Safari.app/", and an NSURL.  In the 64 bytes of 
that NSURL, the 0x051bac30 in line 2 column 3 of those NSURL bytes looks like 
part of a pointer to that string, at 0x1051bac30, and presumably it's an 
instance variable.  But when I break on the designated initializer (thanks 
Kyle) -[NSURL initWithString:relativeToURL:] and log the two parameters, I 
never see anything like "file://localhost/Applications/Safari.app/".  Not so 
smart, after all :(






_______________________________________________

Cocoa-dev mailing list ([email protected])

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

This email sent to [email protected]

Reply via email to