Re: Leaking Mach Ports?
Re: Leaking Mach Ports?
- Subject: Re: Leaking Mach Ports?
- From: Chris Sarcone <email@hidden>
- Date: Fri, 11 Mar 2005 13:02:15 -0800
Dirk --
CFMessagePortRef portRef = CFMessagePortCreateRemote(
kCFAllocatorDefault,
portNameRef);
if (NULL != portRef) {
// we have found valid client port
if (CFMessagePortIsValid(portRef)) {
success = CFMessagePortSendRequest ( portRef, kMyMessageID,
sendDataRef, kSendTimeout, kReceiveTimeout, NULL, NULL);
CheckError( success);
}
CFRelease(portRef);
}
After stepping through this code the number of send rights remain
increased.
Is there anything wrong with this code?
I'm definitely no expert on CFMessagePort (was just trying to lend a
helping hand). However, looking at the source code, it appears it will
create a remote port regardless of whether you have specified wanting a
reply or not. In your case, it appears you don't want to wait for a
reply. It looks like CFMessagePortInvalidate() might need to be called
after sending the message in order to get the reply port released. I'm
not sure if this works as intended or if it's a bug. Looking at the
documentation doesn't provide any extra insight either (at least for
me). I'd suggest filing a bug with this example and see what those more
familiar with CFMessagePort say...
-- Chris
--------
6 Infinite Loop
M/S 306-2MS
Cupertino CA 95014
phone: (408) 974-4033
fax: (408) 862-7577
email: email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden