Re: GC pros and cons
Re: GC pros and cons
- Subject: Re: GC pros and cons
- From: Thomas Davie <email@hidden>
- Date: Sat, 27 Jun 2009 14:17:08 +0200
On 27 Jun 2009, at 14:04, Klaus Backert wrote:
On 27. Jun 2009, at 09:54, Thomas Davie wrote:
On 27 Jun 2009, at 01:27, James Gregurich wrote:
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.
Uhhh, you mean a garbage collector? That's exactly what it does --
frees objects when nothing depends on them any more.
Now I'm confused, because other people said, GC frees objects *when*
nothing depends on them any more *or* at some point later in time.
By the way, it would be different, if you said "if" instead of
"when", but then, I think, you would have no point in the ongoing
discussion.
Why is this a problem? Nothing depends on the objects, and hence
nothing can see when they're actually collected. If you're worried
about running out of space because the collector is lazy, then all you
need to know is that as soon as you get to the "oh shit, no memory"
stage, the collector runs and frees some more up (unless there really
is none to free up).
All you're doing by keeping track of the dependancy graph yourself is
reinventing the wheel -- lots of people have put a lot of research
into how to keep track of those dependancies fast, and in a way that
frees up memory quickly and efficiently.
Bob
_______________________________________________
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