NSURL leaking 1.7kb ?
NSURL leaking 1.7kb ?
- Subject: NSURL leaking 1.7kb ?
- From: nick briggs <email@hidden>
- Date: Mon, 21 Mar 2005 14:07:53 +0000
<x-tad-bigger>Hi All
I am experiencing a strange leak with NSURL.
I instantiate the url, either via NSKeyedArchiver:
</x-tad-bigger><x-tad-bigger>NSURL *_url;</x-tad-bigger><x-tad-bigger>
</x-tad-bigger><x-tad-bigger>_url = [[coder decodeObjectForKey:@"url"]retain];
or in the case of a new document:
_url = [[NSURL URLWithString:_path]retain];
So, nothing unusual there. I then routinely use the NSURL to either instantiate a NSXMLParser:
NSXMLParser *_parser;
_parser = [[NSXMLParser alloc] initWithContentsOfURL:_url];
....
[_parser release];
or, as a test
NSData *data = [[NSData dataWithContentsOfURL:_url]retain];
...
[data release];
In both cases, each time the NSXMLParser or NSData object is instantiated using the NSURL, a 1.7kb leak occurs, this is clearly shown in MallocDebug.
So looking in ObjectAlloc we see that every time the new parser / data objects are instantiated using the url, each of the following allocations occur, and are never released:
NSURLCacheNode x1
NSURLConnection x1
NSURLConnectionCallBack x1
NSConnectionLiteral x1
NSRecursiveReadWriteLock x2
NSURLRequest x2
</x-tad-bigger><x-tad-bigger>NSURLRequest x2
1) This can not be right?
2) How to avoid this?
Best
Nick
</x-tad-bigger><x-tad-bigger>
</x-tad-bigger><x-tad-bigger>
</x-tad-bigger><x-tad-bigger>
</x-tad-bigger><x-tad-bigger>
</x-tad-bigger> _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden