Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: about memory



On Thursday, July 25, 2002, at 05:23 , Chong Hiu Pun wrote:

In using NSOpenPanel, do we need to call alloc and dealloc?

Nope. As for dealloc, but for the [super dealloc] in dealloc itself, you NEVER EVER call it.

NSOpenPanel *panel = [[NSOpenPanel alloc] init]

Wrong.

panel = [NSOpenPanel openPanel];

Right.

[NSOpenPanel dealloc]

Very very definitely wrong. Not only you never ever send dealloc explicitly; also, you don't send (in this context) message to a class, but to the instance.

NSOpenPanel *panel = [NSOpenPanel openPanel];

That's it.

Thank you very much ( as my concept on cocoa memory management is not so good

Why not reading the docs, and perhaps some of those so many articles on Stepwise?
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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.
References: 
 >about memory (From: "Chong Hiu Pun" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.