I am having heart attacks and couldnt find the problem, pls see the screenshots below from instruments tool leakage window, I am retaining xmlBody and copying doc in header file by @properties.
I t also crashes if I relase the theXML object..dont know why..the other objects are released in dealloc method
@property (nonatomic,retain) NSURLConnection *conn;
@property (nonatomic,retain) GDataXMLDocument *doc;
@property (nonatomic,copy) NSString *xmlBody;


another method

Is
self.docaretainorcopyproperty?If so, you should initialize it like this:
What happens with
theXMLis following:you alloc and init one string object; theXML points to it;
here, you create an autorelease string by calling
stringByReplacingOccurrencesOfString, then maketheXMLpoint to it; the previous value oftheXMLis lost; so you have a memory leak;here, you create an autorelease string by calling
stringByReplacingOccurrencesOfString, then maketheXMLpoint to it; the previous value oftheXMLis lost, but it does not matter because the object was autoreleased, so it will be release automagically at some point in time.In this case also, what you need to do is:
and keep the rest of your code, or, if you do not want to autorelease (but it’s ok), then: