[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Releasing objects declared in method?
From: |
Albert Chun-Chieh Huang |
Subject: |
Releasing objects declared in method? |
Date: |
10 May 2003 19:57:35 +0800 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
Dear all,
If this is an FAQ, please forgive me. I really can't find
information.
My question is how to perform memory management efficiently for
temporary objects declared in method? For example:
- aTrivialMethod {
id tmpObject;
tmpObject = [[NSMutableArray arrayWithCapacity: 8]
initWithCapacity: 8];
[tmpObject addObject: something];
return [tmpObject count];
}
Questions:
1. Do I need to release tmpObject *explicitly*?
2. If I need to release it, when and how?
3. If I need to release it before the method ends, does it mean that I
can't use "return [tmpObject count]" statement?
Thanks for your reply.
Best Regards,
Chun-Chieh Huang
--
Chun-Chieh Huang, aka Albert | E-mail: jjhuang AT cm.nctu.edu.tw
黃俊傑 |
Department of Computer Science |
National Tsing Hua University | MIME/ASCII/PDF/PostScript are welcome!
HsinChu, Taiwan | NO MS WORD DOC FILE, PLEASE!
- Releasing objects declared in method?,
Albert Chun-Chieh Huang <=