> On Jan 25, 2017, at 11:23 AM, Dave <[email protected]> wrote: > > I hate it when people as that question! There are some memory leaks in a 3rd > party package. It overrides release to unregister an observer but doesn’t > call super. If I call super the leaks go away and all is well. I just want to > know where is it documented really, I can’t find it searching the docs.
Look at Apple's Foundation NSObject protocol reference document for the -release method. It includes this statement: "You would only implement this method to define your own reference-counting scheme. Such implementations should not invoke the inherited method; that is, they should not include a release message to super." My framework does NOT define its own reference-counting scheme, within the meaning of that quotation. Instead, my framework overrides -release for the SOLE PURPOSE of unregistering an observer the last time a standard -release is called on the given object -- that is, when the separately maintained weakRetainCount reaches the specified value. In all other respects, my framework relies on the -release method to do what it always does. Therefore, it IS in fact necessary to include [super release] at the end of the override. -- Bill Cheeseman - [email protected] _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
