• 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: dealloc and scarce resources
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dealloc and scarce resources


  • Subject: Re: dealloc and scarce resources
  • From: James Merkel <email@hidden>
  • Date: Thu, 30 Jun 2011 13:33:59 -0700


On Jun 30, 2011, at 12:21 PM, Kyle Sluder wrote:

On Thu, Jun 30, 2011 at 12:12 PM, James Merkel <email@hidden> wrote:
Ok, I don't know what an -invalidate method is, but I'll look it up.

It's the thing Wim talked about. An explicit way to release the scarce resource you're holding on to. Depending on what that resource is, an appropriate name might be -close, or -invalidate, or -terminate.

--Kyle Sluder

I saw that in Wlm's post. However, I'm not sure where I would do that. I'll have to think about it some more.


By the way my original post referred to the Memory Management Programming Guide and the statement:
"You should typically not manage scarce resources such as file descriptors, network connections, and buffers or caches in a dealloc method."


I was pretty sure that "file descriptors" referred to something at a lower level, but wasn't sure. Maybe I'm being pedantic, but Apple could have helped things along by saying:
"You should typically not manage scarce resources such as Unix file descriptors, ..."
Everyone doesn't approach this stuff with the same background.
We find from Kernighan and Ritchie (K&R) second edition, section 8.1 that a file descriptor is a small non-negative integer that refers to a file and is maintained by the system. So, my guess is that when Instruments shows an FD of -1 it refers to an FD that isn't mine. But that's just a guess. Instruments doesn't document this as far as I know.


Jim Merkel

_______________________________________________

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: dealloc and scarce resources
      • From: Ken Thomases <email@hidden>
    • Re: dealloc and scarce resources
      • From: Jens Alfke <email@hidden>
    • Re: dealloc and scarce resources
      • From: Jerry Krinock <email@hidden>
References: 
 >dealloc and scarce resources (From: James Merkel <email@hidden>)
 >Re: dealloc and scarce resources (From: Quincey Morris <email@hidden>)
 >Re: dealloc and scarce resources (From: James Merkel <email@hidden>)
 >Re: dealloc and scarce resources (From: Kyle Sluder <email@hidden>)
 >Re: dealloc and scarce resources (From: James Merkel <email@hidden>)
 >Re: dealloc and scarce resources (From: Jean-Daniel Dupas <email@hidden>)
 >Re: dealloc and scarce resources (From: Ken Thomases <email@hidden>)
 >Re: dealloc and scarce resources (From: James Merkel <email@hidden>)
 >Re: dealloc and scarce resources (From: Kyle Sluder <email@hidden>)
 >Re: dealloc and scarce resources (From: James Merkel <email@hidden>)
 >Re: dealloc and scarce resources (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: [Q] Will the be any problem in implementing an NSArray method using fast enumeration?
  • Next by Date: Re: Activate app but bring only *one* window to the front
  • Previous by thread: Re: dealloc and scarce resources
  • Next by thread: Re: dealloc and scarce resources
  • Index(es):
    • Date
    • Thread