Hi everyone,
I am building an iPhone app that parses a couple of xml files using TouchXML. I have a class XMLParser, which takes care of downloading and parsing the results. I am getting memory leaks when I parse an xml file more than once with the same instance of XMLParser.
Here is one of the parsing methods:
The first time, I parse the xml no leak shows up in instruments, the next time I do so, I got a lot of leaks (NSCFString / NSCFDictionary).
Instruments points me to this line in CXMLNode.m, when I dig into a leaked object:
I fixed the problem myself. It is nothing wrong with the TouchXML Code - it was kind of stupid, but maybe someone might come across the same thing, so I am going to post it here.
1) I had a mutable array set up as instance variables like this:
I fixed the problem myself. It is nothing wrong with the TouchXML Code - it was kind of stupid, but maybe someone might come across the same thing, so I am going to post it here.
1) I had a mutable array set up as instance variables like this:
Whew, that has been a lot of work to find out - hope it saves someone else some time :-)
Hi Friend,
I am going through a similar problem. I am also using a custom parser to parse incoming data. But when I check it through Leaks tool, I find the most of the objects I use are leaking. Pleas could you help me?.
Your dealloc method should include a call to super dealloc. Leaving that off, and it's pretty easy to do, can cause an object to stick around though the retain count for the object is actually zero.
Your dealloc method should include a call to super dealloc. Leaving that off, and it's pretty easy to do, can cause an object to stick around though the retain count for the object is actually zero.
Why send a release message to a pointer that you know points to nil? I know doing so is harmless, but if you are going to use both statements, wouldn't the reverse order be more logical.
Why send a release message to a pointer that you know points to nil? I know doing so is harmless, but if you are going to use both statements, wouldn't the reverse order be more logical.