[Newbie] reference count
[Newbie] reference count
- Subject: [Newbie] reference count
- From: kunikyo <email@hidden>
- Date: Fri, 16 May 2003 22:53:50 +0900
[Newbie] reference count
Hello all,
Now I am reading "Cocoa Programming" by Scott Anguish, et al.
and having a basic question about reference count that
I'm hoping people can answer.
On page 223〜page 272, I have found following two questions on a sample
program.
I traced the opening sequence and found successive allocWithZone twice,
and
_myOpenDocuments is not released after the Quit of the sample program.
The first question is about the following message.
_myOpenDocuments = [[NSMutableArray allocWithZone:[self zone]] init];
This message is called in -init and -awakeFromNib, so this message is
called
twice at the opening sequence.
Is it permitted that allocWithZone of the same array is called twice?
Reference count kept 1 after twice call of allocWithZone.
I think that we need allocWithZone of -awakeFromNib but
we do not need allocWithZone of -init.
The allocWithZone of -init does not make sense to me.
The second question is that _myOpenDocuments was not released
after all.
We find [_myOpenDocuments release]; in - (void)dealloc,
but this was not invoked after selecting Quit on menu.
I am afraid of memory leak.
Thanks for the assistance!
Kunikyo
_______________________________________________
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.