• 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: Yet another memory management question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Yet another memory management question


  • Subject: Re: Yet another memory management question
  • From: Michael Ash <email@hidden>
  • Date: Sun, 5 Jul 2009 11:23:18 -0400

On Sun, Jul 5, 2009 at 12:10 AM, mmalc Crawford<email@hidden> wrote:
>> Both are fine, but I would suggest something like the following, just
>> because it avoids code duplication:
>> - (void)viewDidUnload
>> {
>>   [self dispose];
>> }
>>
>
> It is not clear here what is the benefit of "avoiding code duplication" --
> you're simply introducing another method that you have to keep track of.

It's the same benefit as anywhere else. You have two places,
viewDidUnload and dealloc, which perform the exact same action. Rather
than have identical code in both places, where it bloats up your code
and can fall out of sync, you put that code into a separate method,
then call it from the two places where it needs to happen. This is
pretty basic programming.

Mike
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Yet another memory management question
      • From: mmalc Crawford <email@hidden>
References: 
 >Yet another memory management question (From: DKJ <email@hidden>)
 >Re: Yet another memory management question (From: WT <email@hidden>)
 >Re: Yet another memory management question (From: mmalc Crawford <email@hidden>)

  • Prev by Date: Re: Yet another memory management question
  • Next by Date: Re: Wrap to Page method
  • Previous by thread: Re: Yet another memory management question
  • Next by thread: Re: Yet another memory management question
  • Index(es):
    • Date
    • Thread