Memory Leak with CFSocket objects
Memory Leak with CFSocket objects
- Subject: Memory Leak with CFSocket objects
- From: pranav sahu <email@hidden>
- Date: Tue, 18 Nov 2003 05:50:02 -0800 (PST)
Hi,
I am using CFSocket for asynchronous mechanism on native sockets.
So I am calling "CFSocketCreateWithNative" on my native socket as follow :
CFSocketRef s;
CFSocketCreateWithNative(NULL, nativeSocket, kCFSocketAcceptCallback, dealWithAcceptCallback, NULL);
//dealWithAcceptCallback is my callback.
And I do call following in my callback.
CFSocketInvalidate(s);
CFRelease(s);
But still my object is not released. I used a call CFGetRetainCount to get the reference count. For first call of CFSocketCreateWithNative, it gives the count as two, for rest it's one.
If I do a call CFAllocateDeallocate to manually remove the object it crashes. It's obvious as I am not allocating this object so I should not deallocate.
In my case reference counting never becomes 0, so as my object never gets deleted. Am I missing some thing here ?
Why my object is not deallocated ?
Another problem is with CFunLoop object(Created with CFSocketCreateRunLoopSource), that I attached with current
runloop in my App. How can I get that object in my callback function(I could not find any API neither in CFRunLoop nor in CFSocket) ? And how I can release that object?
Any help or clue will be great.
Rgds
Pranav
_____________________________________________________________
Secure mail --->
http://www.blackcode.com
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.