Re: Strange memory leak with AsyncSocket and multithreading
Re: Strange memory leak with AsyncSocket and multithreading
- Subject: Re: Strange memory leak with AsyncSocket and multithreading
- From: AgentM <email@hidden>
- Date: Thu, 10 Aug 2006 15:29:01 -0400
The leak makes sense because the runloop will want a few additional
iterations to actually perform on the selector. When you exit, the
run loop will still have sources to service. Instead, wait until the
runloop is out of sources (remove any necessary sources) and then
simply return from the method.
-M
On Aug 10, 2006, at 14:59 , Martin Redington wrote:
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 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.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40themactionfaction.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden