• 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: about memory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: about memory


  • Subject: Re: about memory
  • From: Ondra Cada <email@hidden>
  • Date: Thu, 25 Jul 2002 16:19:35 +0200

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>)

  • Prev by Date: Re: What is the purpose of static typing?
  • Next by Date: Re: What is the purpose of static typing?
  • Previous by thread: Re: about memory
  • Next by thread: any constructor
  • Index(es):
    • Date
    • Thread