Hi,
I init my NSXMLParser with a mutable data, that I get from the internet. I wonder whether the parser releases it on its deallocation or I have to release it after the parsing?
Thanks
Hi,
I init my NSXMLParser with a mutable data, that I get from the internet. I wonder whether the parser releases it on its deallocation or I have to release it after the parsing?
Thanks
If you have retained it, and you no longer use it, then release it. The NSXMLParser will most likely retain the data itself and release it when it is finished with it.
Cocoa uses the "It's not my problem" metaphor to memory management.
If you pass something to another object, it is that objects responsibility to retain it.
If something is passed to one of your objects, you need to retain it or it may go away.
Generally pass objects like:
[otherObject doSomethingWith:[myThing autorelease]];
OR
[otherObject doSomethingWith:myThing];
[myThing release];
The Cocoa frameworks work on this principle and you should design your classes the same way.