0

I have a NSURLConnectionDelegate object handling some SOAP communications. Essentially I'm setting a few property values, and then calling a method that builds an xml request and then sends it to the server. The object is also a NSXMLParserDelegate so it can parse the xml responses from the server and process the data appropriately.

When using the object I first set values for a number of properties. The retain count after is still one. I then call my first method and that is when the fun begins. Any time a custom method, or a NSURLConnectionDelegate method is called the retain count increases by 1. When NSXMLParserDelegate methods are called this doesn't happen. After all communications are finished and I'm done with the objects it's retain count it 43. Releasing the object does not decrease the retain count, so I end up with an object that I can't free. Besides that the object works as expected.

There is a lot of code and I'm not really sure what's relevant since it doesn't actually seem like anything I'm doing inside the methods is causing the retainCount to increment. The only other thing worth mentioning is that I'm calling these methods from a background thread but performing them on the main thread:

[tEditor performSelectorOnMainThread:@selector(requestQueueList) withObject:nil waitUntilDone:YES];
Kris
  • 349
  • 1
  • 2
  • 13
  • Could it happen that you've overridden your `NSURLConnectionDelegate` `release` ? I mean `performSelectorOnMainThread` must automatically retain both the object and the argument until the selector is done, but then they should be released automatically as well. If your release method is empty, the retain count will only grow. – A-Live May 08 '12 at 16:33
  • Haha, holy crap I feel like an idiot. I had one of my parameters, an NSString, named "release". I changed that everything is working as it should. Thanks a bunch, I hate when I overlook something simple like that. – Kris May 08 '12 at 16:53
  • Cool, i think you should post it as an answer and accept for future reference. – A-Live May 08 '12 at 16:56

1 Answers1

0

Turns out I named a synthesized property "release" and had inadvertently overwritten the object's release method. Oops!

Kris
  • 349
  • 1
  • 2
  • 13