开发者

memory mgmt question about memeber variables - objective c

开发者 https://www.devze.com 2023-02-27 18:32 出处:网络
i have some memory issues in program and i have the following questions. question 1) i have a member variable of type nsstring and i dont have any property for it , i used it without self.xxx in vari

i have some memory issues in program and i have the following questions.

question 1) i have a member variable of type nsstring and i dont have any property for it , i used it without self.xxx in various methods to access it. i have not allocated any memory for this variable and i need to know do i still have to release it in dealloc and assign nil in viewdidunload.

question 2)

i have a member variable with (nonatomic , retain) property. i ha开发者_如何转开发ve not used this vairable outside the class anywhere whatsoever. in order to use it within various methods of the class is it necessary for me to allocate memory for it or should it self.membervariable.

question 3) Do all iboutlet's with property(nonatomic,retain) require self.outlet=nil in viewdidunload and [outlet release]; in dealloc;

question 4) what about iboutlet's without property , do i have to do outlet=nil in viewdidunload and [outlet release]; in dealloc.


Please follow http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/MemoryMgmt/Articles/mmPractical.html link to know best memory management techniques.

Hope it helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号