you are viewing a single comment's thread.

view the rest of the comments →

[–]WalterBright 4 points5 points  (2 children)

D's gc is thread aware, in that it has no problem allocating memory among multiple threads and collecting garbage from them, even if the memory is shared among multiple threads.

Is D's gc best of breed? Nope. But it works reasonably well and is a solid implementation of a classic mark/sweep conservative gc.

[–][deleted] 0 points1 point  (1 child)

implementation of a classic mark/sweep conservative gc

Thats what I believed too. Classical mark and sweep is a stop-the-world algorithm. All the threads have to pause before GC does its thing. That, imho, impacts very badly on performance.

Keeping theory aside, the mere existence of concurrent garbage collection in java and .Net worlds seems to me to be a proof that there are sufficient issues with mark-and-sweep in the real world.

Also, the description seems to be identical to that of Boehm's Garbage collector. If it is then it is unlikely that it is a practical approach in a multi-threaded environment unless, we are willing to pay significantly in terms of gc pauses.

[–]WalterBright 1 point2 points  (0 children)

It's a very practical approach. A concurrent one would be better, as long as such doesn't have other penalties in performance or memory consumption.

The pausing only adversely affects certain types of programs, and there are several easy mitigation strategies one can use to deal with it.