Skip navigation.
 
mlRe: Strange memory leak with AsyncSocket and multithreading
FROM : AgentM
DATE : Thu Aug 10 21:29:01 2006

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_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/agentm%
> 40themactionfaction.com
>
> This email sent to <email_removed>

Related mailsAuthorDate
mlStrange memory leak with AsyncSocket and multithreading Martin Redington Aug 10, 20:59
mlRe: Strange memory leak with AsyncSocket and multithreading AgentM Aug 10, 21:29
mlRe: Strange memory leak with AsyncSocket and multithreading Martin Redington Aug 11, 06:55