Re: GC pros and cons
Re: GC pros and cons
- Subject: Re: GC pros and cons
- From: Kyle Sluder <email@hidden>
- Date: Fri, 26 Jun 2009 16:41:58 -0700
On Fri, Jun 26, 2009 at 4:27 PM, James Gregurich<email@hidden> wrote:
> ok. What percentage of cocoa classes will exhibit the behavior you describe? I've never seen an objc class that mysteriously hangs around beyond the destruction of its dependencies (including any autorelease pools that contain it). I wouldn't be shocked if there were some....maybe some system singletons?
100% might. Maybe 0% today, and then tomorrow Apple might release an
update that causes all objects to hang around forever. You don't
know, and you shouldn't care.
> If 90% of objc classes are completely deterministic in their life cycle behavior with retain/release and 10% aren't, I'll not use the 10% to make the case that I should introduce even more entropy into my system by using garbage collection.
If this is your attitude you're unprepared for the reality of modern
software development. And I suggest you never touch NSFont, NSColor,
NSWindow, or NSMenu; they might stick around longer than you intended!
> GC isn't nirvana. it does have its perils and issues, and you have to be aware of them and code around them. You can't just turn it on and some how everything magically works. There is no perfect solution to memory management. I prefer a solution where I manage the dependencies and objects go away in an orderly fashion based on the dependency graph for those objects.
Then Cocoa's obviously not your cup of tea.
> additionally, I find the notion of adding an extra subsystem that periodically scans memory looking for pointers to be foolhardy. my code already knows what needs to be cleaned up and when. I don't need a system sitting in the background scanning memory trying to clean up behind me. All I need is a mechanism to do the cleanup in a maintainable and extensible manner.
"My code already knows how it's going to use its memory; why should we
have some stupid little chip -- watchyacallit, an MMU? -- to do that
for me?" The creators of garbage collectors don't consider them to be
panaceas. There are a very well known class of problems which GC
utterly fails in. There's also a rather large class of problems which
can only be solved (that is, solved by a programmer within a normal
human lifespan) with some form of automatic garbage collection. The
Lisp guys can probably come up with boatloads; after all, they've had
since the late 50's.
--Kyle Sluder
_______________________________________________
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