In instruments I can see I have a memory leak with NSMachPort and CFRunLoopSource (whats this?) both seem to come from the parseXMLFileAtURL. What I can see is also that myUrl have a retainCount of how the same size as how many rows I have parsed from the xml when writing it to the log. 7 in my case, so I think this is maybe what's wrong but I'm not sure how to do this, I can't release myUrl as I'm not init it? And in the parseXMLFileAtURL all I do is passing it onto the initWithContentsOfURL-method, can't see whats wrong here, anyone?
In instruments I can see I have a memory leak with NSMachPort and CFRunLoopSource (whats this?) both seem to come from the parseXMLFileAtURL. What I can see is also that myUrl have a retainCount of how the same size as how many rows I have parsed from the xml when writing it to the log. 7 in my case, so I think this is maybe what's wrong but I'm not sure how to do this, I can't release myUrl as I'm not init it? And in the parseXMLFileAtURL all I do is passing it onto the initWithContentsOfURL-method, can't see whats wrong here, anyone?
Thanks really much for your help!
Hi, I am also having the same problem.
If u found the solution, please help me...
Thank u.
I wish I had the answer to your question, but I'm a bit curious what's amiss too as it looks ok to me - in general my understanding is you only release objects you "own", which happens when you alloc, retain or copy. You seem to have those bases covered, and convenience constructors should autorelease afaik.
However, I did notice that you were creating an NSString inside your log statement. NSLog does a stringWithFormat on it's own so you could shorten that log statement to be:
Code:
NSLog( @"retainCount of myUrl: %i",[myUrl retainCount] );
You definitely want to try the Instrumentation option for "Leaks" and let it tell you where the leak is coming from. I used this tool (part of XCode, in the Run menu) to find the leak inside the sendSynchronousRequest method call on NSURLConnection. Details here on my blog post.
Here is the problem I am having. For the following RSS feed example, I am having trouble getting it to load the feed. Comes up with an error that it cannot connect. However on my Mac RSS Reader it works fine, so I know the link is good.
Any ideas on why it cannot load this particular feed but it can load others fine?