Featured Article: Dave The Nerd - My Backup Strategy
Windows .NET Developer Says Leopard Years Ahead
by , 2:10 PM EST, January 26th, 2007
A programmer who said he'd written a flaming truckload of C# and .NET code attended an Apple Leopard Tech Talk in New York. He saw some things that were lacking, but also saw things that seemed years ahead of Microsoft offerings. He described his experience at the .NET Addict Blog on Friday.
The author went to great lengths to point out that he was honoring his Non-disclosure Agreement (NDA) with Apple. Given that, we went on to describe his experience at the talk. At one point, when another Apple developer discovered that he was running Vista and took a look at his computer, Vista crashed, dumped core, and rebooted in front of everyone at the breakfast table accompanied by riotous laughter.
The most telling part of the story was the description of Apple's Objective-C, Cocoa, Xcode 3, Core Animation and Quartz Composer tools. His Blog explained: "All of these things combine to make Mac OS X Leopard the most appealing version of OS X for a .NET developer. Mainly because up until Leopard, the main development language (Objective-C) has not been a garbage collected environment. .NET developers (who often tend to be ex-COM programmers) take one look at all the alloc and dealloc and reference counting and retain keywords and their faces blanch with terror and they run away screaming for mommy."
The programmer is going to publish again, in greater detail, when Leopard ships and his NDA expires. In the meantime, he's purchasing a new MacBook Pro.
Observer Comments
Fri Jan 26, 2007 7:18 pm Subject: You're asking us MacFanBoys about Garbage Collection?
Fri Jan 26, 2007 9:47 pm Subject: Garbage collection
I think what he means by garbage collection in this context is automatic memory and array allocation, which can grow automatically as needed, and is automatically deallocated when the context of the variable terminates. I would expect the runtime environment to also support explicit memory management via alloc/dealloc.
QuoteGuest wrote:
If this is accurate does the change from C+ to C+ 2.0 which has Garbage Collection automated allow the mixture of automated Garbage Collection and explicit memory management (alloc dealloc)?
Thanks
br
I believe so, yes. I know that you can at least turn off garbage collection and rely strictly on the old manual management if you prefer. I assume that mixing is just fine, too, and you can manually clean up whatever you want, and let the garbage collector take care of the rest. However, I'm not sure I've seen that last part explicitly stated anywhere. I think it's a safe assumption, though.
(I assume by "C+" you mean "Objective-C".)
Oh, one more thing: I think (not 100% sure) that this new garbage collection applies only to Objective-C objects, not manually malloc'd data. In other words, it replaces (or supplements) the [object release] convention.
Mon Jan 29, 2007 4:14 am Subject: Garbage Collection
Garbage Collection is one of the standard ways to manage the use of memory (RAM) in any program. One advantage of garbage collection is that it can be provided as a service that programmers can simply presume will happen by magic (as in the real world if you pay your taxes). About garbage collection:
The programmer has to allocate a block of RAM (random access memory) cells to hold any piece of information. Each memory cell is numbered with a unique address. He keeps track of the blocks of information with pointers, which are just the address of the (first cell of the) block, stored inside some other block.
Something has to keep track of the pool of free memory. When a piece of information is no longer needed, its memory block needs to be returned to the pool.
If a fault in a program means blocks are not being returned when they are no longer in use, it's called a memory leak. Eventually the program can run out of memory and be unable to deal with new information.
One way the programmer can keep track of when to free a block, is to use a reference count stored in every block. When a pointer to the block is made, one is added to the reference count. When a pointer to the block is removed, one is subtracted. When the count is zero, the block is returned to the pool. This is how Objective C and Realbasic work, I believe. A problem is that programmers have to deal with this throughout their programs. A tricky detail is that circular chains of pointers can become isolated knots of blocks that will never be released.
Garbage collection is an alternative. By periodically tracing through every pointer in the program, the blocks in use are identified. All the others can be freed. Two significant problems: 1. the language (unlike C or C++) must be a "safe" language (like Java) where the garbage collector can know which memory words are pointers, and which are other kinds of data. 2. The garbage collector needs to stop the program while it cleans up, potentially causing periodic freezes in a real time or interactive program.
Summary: Garbage Collection is a popular service for programmers, but it can easily disrupt smooth operations while it's being done.
Quotesleepygeek wrote:
One way the programmer can keep track of when to free a block, is to use a reference count stored in every block. When a pointer to the block is made, one is added to the reference count. When a pointer to the block is removed, one is subtracted. When the count is zero, the block is returned to the pool. This is how Objective C and Realbasic work, I believe
REALbasic does have garbage collection. Actually, REALbasic is about as automatic as can be. You can't manually manage memory even if you want to. (At least not in version 5, which is the latest version I'm really familiar with.)
When I moved from RB to Cocoa/Objective-C, the whole retain/release thing was very hard to wrap my head around. I have a good grasp of it now, and I'm glad I do, but I will certainly appreciate a little automation to clean up after any careless mistakes I make.
Recent Headlines - Updated Friday, July 25th, 2008
- Fri., 3:30 PM
- CheckUp 1.2 Features Updated UI, Lower Price
- 3:05 PM
- iPodObserver - Barron's: iPhone 3G Push E-mail with Exchange a Delight
- 2:20 PM
- iPodObserver - Gartenberg: Zune Phone Unlikely
- 1:35 PM
- iPodObserver - TopMuffin Tracks iPhone Avialability All Day
- 1:05 PM
- CheckUp 1.2 Adds Wi-Fi Network Detector
- 12:40 PM
- AOL Cuts Back on Blogs to Save Cash
- 11:35 AM
- Mac Gaming News - Macgamestore Intros SCRABBLE Journey for the Mac
- 10:25 AM
- Hot Forum Topic - Hunting for iPhones
- 10:00 AM
- iPO Review - Griffin Elan Form
- 8:35 AM
- AirPort Extreme 2008-002 Fixes Tiger Audio Issues
- 7:30 AM
- TMO Quick Tip - Address Book: Selectively Hiding Your vCard Info
The Mac Observer Reader Specials
- Download Typestyler, still the Ultimate Styling Tool for Internet, Print and Video Graphics. Works great in Classic with a Native OS X Version on the way. Free Tryout: www.typestyler.com
- Other World Computing has the Upgrades, Enhancements, and Accessories for getting the most from your Mac. Quality Products, Competitive Prices, Expert Support Staff - www.macsales.com
New iMac 800Mhz Memory 4GB $98, 2GB $50. Click to Maximize your Macs...
Mac observers can now play Party Poker for Mac as well as Mac casino games by going to MacPokerOnline.com.
RamJet Memory: MacBook 1Gig $39, 2Gig $78, 4Gig $195! Mac Pro 2Gig $115, 4Gig $189! 500G Seagate SATA II $139! Click hereFor the latest Apple products use Ciao a comparison website to find laptops like MacBook Air. Then find the best prices on MP3 players and use our comparison tool to evaluate cell phones.
Laptop Hardware Provided by TechRestore - Overnight Mac & iPod Repairs.


