Re: CFRunLookFindMode crash - revisited
Re: CFRunLookFindMode crash - revisited
- Subject: Re: CFRunLookFindMode crash - revisited
- From: Martin Redington <email@hidden>
- Date: Mon, 4 Dec 2006 09:41:32 +0000
I recently had reason to look at this issue again.
As it turns out, although the solution we found doesn't leak
mach_ports, once you start doing stuff on the threads, it starts
leaking mach_ports again. In my app, I seem to leak a couple of ports
for each thread.
I took a look with OmniObjectMeter, and as far as I could make out,
it looked like these were being over-retained by a runLoop. Typically
I'd see two or three extra retains. In the original SimpleThreads
example this is hinted at in a comment by timc:
/*
TIMC
Currently, this routine does not work properly. Both connection
objects seem to be retained many more times than necessary -- and the
number goes up as you make server calls. So, this is close to what
is needed, but clearly something else is going on in DO.
*/
As I'm pooling threads in my app, this doesn't bite me, but if I
disable thread pooling, and run with the solution described earlier
in the thread, I leak mach_ports, and eventually die with the
familiar CFRunLookFindMode crash. Unfortunately, I don't have a test
case I can post right now, as the code that "does stuff" is proprietary.
I can't believe this is really the case - presumably DO is in fairly
constant use, so surely this would have come up before now - but I
can't work out what I'm doing wrong.
Should I just expect some leakage?
On 17 Nov 2006, at 14:27, Nir Soffer wrote:
On 17 Nov 2006, at 15:44, Martin Redington wrote:
In the meantime, I've also uncovered (with lots of help) the
underlying source of the problem - its a mach_port leakage issue -
the Apple (and other) sample code appears to leak mach_ports like
a sieve.
See http://www.cocoadev.com/index.pl?
DistributedObjectsForInterThreadCommsCrash for the gory details,
and a fix.
Thanks for sharing. I'm sure many developers would find this useful
- unlike those top secret bug reports.
I can confirm that my code (posted before) also leak 2 ports for
every thread I create and destroy.
Best Regards,
Nir Soffer
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden