Strange memory leak with AsyncSocket and multithreading
Strange memory leak with AsyncSocket and multithreading
- Subject: Strange memory leak with AsyncSocket and multithreading
- From: "Martin Redington" <email@hidden>
- Date: Thu, 10 Aug 2006 20:10:12 +0100
I'm having a strange leak with AsyncSocket in secondary threads, but
not on the main thread.
I've been using leaks and OmniObjectMeter to debug this.
I've managed to establish that when running under the main thread, an
extra ___delayedPerformCleanup is called from the runLoop, and this
calls an extra release, and the memory is freed.
In my other (non-main) threads, all of the other calls match and
balance the main thread exactly (obviously the stack traces are
slightly different), and I can identify the reason for each of the
calls.
However, the ___delayedPerformCleanup call doesn't occur in the sub threads.
This only occurs with sockets that I used to connect to remote nodes.
I also have accepting sockets in an independent thread.
The matching retain seems to occur inside
-[NSObject (NSDelayedPerforming) performSelector:withObject:afterDelay]
which is called from inside -[AsyncSocket close], but I can't quite
work out exactly which call is responsible for this.
Note that these threads are stopped shortly after the connections
close, using [NSThread exit]
Do I need to let the thread live on a little to give it a chance to clean up?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden