site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, //gcc test.c -framework CoreFoundation -g #include <CoreFoundation/CoreFoundation.h> #include <unistd.h> #include <sys/event.h> What am I missing? Cheers, M -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (Darwin) iEYEARECAAYFAkqNjt8ACgkQqVAj6JpR7t5BwgCgm2K912i93tviOzkFbhNo8cyJ Cn8AoJ8UOliN1+rsERGhGbbkFPD6uuM7 =xSEK -----END PGP SIGNATURE----- _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... I am using CFFileDescriptor and it noticed that it seems to leak its kqueue file descriptor. Here is sample code demonstrating the problem: static void junkCallback(CFFileDescriptorRef fdref, CFOptionFlags callBackTypes, void *info) {} // one argument, an integer pid to watch, required int main(int argc, char *argv[]) { int i; for(i=0;i<3;i++) { CFFileDescriptorRef fdref = CFFileDescriptorCreate(kCFAllocatorDefault, 0, false, junkCallback, NULL); CFFileDescriptorInvalidate(fdref); CFRelease(fdref); //CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1.0, false); // doesn't help to spin the runloop } sleep(100000); return 0; } While the executable is sleeping, I run "lsof -p <pid>" and see the lines for open kqueue descriptors: a.out 725 agentm 3u KQUEUE count=0, state=0 a.out 725 agentm 4u KQUEUE count=0, state=0 a.out 725 agentm 5u KQUEUE count=0, state=0 If I debug the executable, I can plainly see that the kqueue descriptors are opened in CFFileDescriptorCreate() but never closed. Also, the sample code on the documentation page (http://developer.apple.com/documentation/CoreFoundation/Reference/CFFileDesc... ) also seems to leak two fds. This email sent to site_archiver@lists.apple.com