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

Re: Memory Management


  • Subject: Re: Memory Management
  • From: "Dennis C.De Mars" <email@hidden>
  • Date: Wed, 30 Jul 2003 00:30:11 -0700

On Wednesday, July 30, 2003, at 12:08 AM, Wade Tregaskis wrote:

But I agree with you otherwise, that this isn't a perfect solution. But neither is using locks, or using retain+autorelease in your getter methods, due the potentially gigantic overhead both these methods add. I generally find it's a better idea to put locks around large swathes of code, on a task level, rather than on individual objects. Then, even though there may be lots of non-perfect code being used, it's irrelevant. And the performance impact is immeasurable.

Yes, I agree with this and it gets right to the point. Putting any kind of locks a very low level doesn't really help because, first, it's expensive, and furthermore it often doesn't solve the problem because the lock is actually needed at a higher level. It will also be less expensive at the higher level, but the most important thing is correctness and putting locks on individual accessors (setting aside the whole autorelease issue for the moment) won't help much in that regard. After all, if another thread is trying to get that value and you lock it out until you are finished changing it, which value should that other thread have gotten, the one before the change or the one after? Completely depends on the logic of the program, but if it does matter then there probably should have been a lock or other synchronization method at a higher level of the code and using "thread-safe" accessors of any variety will not make this problem go away.

- Dennis D.
_______________________________________________
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.

  • Prev by Date: Change printer in printpanel
  • Next by Date: Re: classNotFoundException NSPopUpList
  • Previous by thread: Re: Memory Management
  • Next by thread: Re: Memory Management
  • Index(es):
    • Date
    • Thread