• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Notification from dealloc and overiding retain/release scheme
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Notification from dealloc and overiding retain/release scheme


  • Subject: Re: Notification from dealloc and overiding retain/release scheme
  • From: Gérard Iglesias <email@hidden>
  • Date: Tue, 17 Sep 2002 14:29:49 +0200

On Tuesday, September 17, 2002, at 01:59 PM, Girard Iglesias wrote:

> if the release is coded like :
>
> - (void)release
> {
> refCount--;
> if (refCount == 0)
> [self dealloc];
> }

I just have the idea to implement the release as :

- (void)release
{
if (itsReferenceCount == 1)
[self dealloc];
else
itsReferenceCount--;
}

I decrement the ref count if the object is not deallocated, by this way
I resolve the specific problem I have, but I am not very happy with
that.

I have the idea because when you are in the dealloc of an object you
see that the ref count is 1, strange for me ?

Looking at the Gnustep code I seee that they are doing almost the same,
but with the zero value, i.e. if an object have its ref count equal to
zero when it receive the release message, then it deallocate itself,
but doesn't decrement the value.

What do you think of that ?

Regards

Gerard
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Notification from dealloc and overiding retain/release scheme
      • From: Gérard Iglesias <email@hidden>
References: 
 >Notification from dealloc and overiding retain/release scheme (From: Gérard Iglesias <email@hidden>)

  • Prev by Date: Protected Nib
  • Next by Date: Re: NSMatrix
  • Previous by thread: Notification from dealloc and overiding retain/release scheme
  • Next by thread: Re: Notification from dealloc and overiding retain/release scheme
  • Index(es):
    • Date
    • Thread