On 28 Jun 2009, at 17:47, Konrad Neitzel wrote:

Thomas Davie <tom.da...@gmail.com> schrieb am 27.06.2009 09:56:31:

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.

But a garbage collector must be able to detect an object which memory can / must be released. And for all this, the system has to do some work.

As must your program do if it keeps track of memory manually. Are you betting you can make that less work than a bunch of compiler engineers can? Note, this actually isn't a bad bet with GC, but it's not a good one either.

I still have to read much more about the GC used within Objective- C / Cocoa so I am not sure, if I am not writing some kind of "bullshit" from your view:

Isn't it possible to simply flag an object to be removed? Is there a dispose pattern in Objective-C? (e.g. http://www.codeproject.com/KB/cs/idisposable.aspx describes such a pattern in C#)

Something like that would simply more the world together again. That way, the developer has some more control, the GC has less work and all are maybe happy?

So is there such an Dispose Pattern in Objective-C using a GC or is there nothing like that?

That sounds exactly like reference counting – and it suffers from all the well known problems (like retain cycles). The point here is that you don't *want* the developer to have control, the developer (myself included) is really really bad at doing this, and introduces a *lot* of bugs in the process.

The option for it of course will keep everyone happy, but that doesn't mean it should be encouraged ;)

Bob_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to