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

Re: Memory Management Mismanaged


  • Subject: Re: Memory Management Mismanaged
  • From: Pete Yandell <email@hidden>
  • Date: Thu, 8 May 2003 18:40:26 +1000

On Wednesday, May 7, 2003, at 09:46 PM, lbland wrote:

On Wednesday, May 7, 2003, at 06:59 AM, Pete Yandell wrote:

Seriously though, grafting full garbage collection onto objective-C would clearly be pretty close to impossible

just for fun...

http://gcc.gnu.org/onlinedocs/gcc-3.2.2/gcc/Garbage- Collection.html#Garbage Collection

OK, two issues here:

Number one is the way that this sort of garbage collection works. It basically scans all of every allocated object looking for pointers. Imagine having a big array of integers or a big slab of text in some allocated memory. The system will scan through all of this memory trying to find pointers to follow. Very inefficient.

Languages which do garbage collection well need to have information about their data structures stored with those data structures to avoid this inefficiency. Indeed, most garbage collected languages have fully dynamic data structures.

Second is that we've got all of the Foundation and Cocoa libraries and all the code that depends on them already built using reference counting. Trying to convert everything over would be a big task, and then you start running into fun with shared libraries and the like.

So I'd make the argument that, given the necessary inefficiency of a C/C++/Objective-C garbage collection system, it's not worth the trouble of converting the large existing codebase over to use one, or of dealing with the surrounding issues.

If anyone out there wants to suggest a good way of going about it and proving me wrong then it'll make me as happy as anyone. :)

Pete Yandell
http://pete.yandell.com/
_______________________________________________
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: 
 >Re: Memory Management Mismanaged (From: lbland <email@hidden>)

  • Prev by Date: NBChart plotting framework/palette
  • Next by Date: How to receive data from printers?
  • Previous by thread: Re: Memory Management Mismanaged
  • Next by thread: Unix -> Cocoa question
  • Index(es):
    • Date
    • Thread