On Nov 2, 2009, at 12:51 AM, Jens Alfke wrote:
Yes; but that doesn't necessarily mean the streams will go away soon if you don't retain them. An NSStream object is usually scheduled on a runloop, which keeps a reference to it as long as its open, so I believe it will stay around even if not explicitly retained by the app.
True. I did one additional test in that I delayed opening the streams by 5 seconds (using performSelector:withObject:afterDelay:), giving the run loop enough time to release them if they were in fact auto- released (I know there's no guarantee they would actually be release in that period of time). The app doesn't crash and keeps working which indicates they are retained.
Sure enough the author of the example project believes what he says because the project doesn't retain the streams anywhere.Does it release the streams? That would be the true test. My belief is that it can get away without retaining them, as long as it never accesses them again after they close; but if it explicitly releases them, it would crash.
Yes, the example releases the streams. They're removed from the run loop first, the author apparently forgot to close them though (not sure if that can have an effect on the retain count).
It appears that Apple already knows about this (see radar in comment), they just forgot to document it. How else would someone who writes example projects for the SDK know this specific function has this very special behavior - not that I know anything about who writes such examples.
Regards Markus -- __________________________________________ Markus Spoettl
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com