Live data from Hacker News

.NET Garbage Collector Basics and Performance Hints (2003)

msdn.microsoft.com

1–10 of 21 posts

Re: .NET Garbage Collector Basics and Performance Hints (2003)

#6
post #3

This article is from 2003.

It's still solid advise, though.

I agree, but if the OP or a mod adds (2003) to the title then it's easier to realize that it's an old version. Perhaps the current version has a few more tricks. Perhaps someone makes a comparison with the current JVM garbage collector, and it would be "unfair" to compare the 2017 version of one against the 2003 version of the other.

Re: .NET Garbage Collector Basics and Performance Hints (2003)

#7
For those interested in more details about .NET garbage collector here is some reading.

Garbage Collection Overview

https://msdn.microsoft.com/en-us/library/0xy59wtx(v=vs.110)....

Fundamentals of garbage collection

https://msdn.microsoft.com/en-us/library/ee787088(v=vs.110)....

Visualising the .NET Garbage Collector

http://mattwarren.org/2016/06/20/Visualising-the-dotNET-Garb...

Clr Book of the runtime : Garbage Collection

https://github.com/dotnet/coreclr/blob/master/Documentation/...

Maoni Stephen's Blog

https://blogs.msdn.microsoft.com/maoni

https://blogs.msdn.microsoft.com/maoni/2004/06/15/using-gc-e...

https://blogs.msdn.microsoft.com/maoni/2004/09/25/using-gc-e...

https://blogs.msdn.microsoft.com/maoni/2004/12/19/using-gc-e...

https://blogs.msdn.microsoft.com/maoni/2005/05/06/using-gc-e...

There is also a refactoring effort to standardize the GCEE interface

https://github.com/dotnet/coreclr/projects/3

I would link to the source code of the GC itself, but it's a single 35KSLOC file.

Re: .NET Garbage Collector Basics and Performance Hints (2003)

#8
post #5

This is a really weird article. It manages to "cover" a huge amount of ground while simultaneously saying pretty much nothing.

It has a bunch of concrete recommendations, and its explanation of how the GC works lets you see the rationale behind those recommendations, and extend them to novel situations.

It explains the middle-age death problem, a direct consequence of the generations, by giving you a mental framework to reason about the .net GC.

I used the insights in this article to build an application server back in 2005 or so that spent about 2% of its time in GC at full load.

Re: .NET Garbage Collector Basics and Performance Hints (2003)

#10
If you are considering GC issues in an app, I think the reference code you should look at now is Roslyn and how it uses pooled ImmutableArrays to work with immutable collections almost without allocation overhead in most areas.

Most GC churn in most applications (I would think) is down to Linq and collection use.

https://github.com/dotnet/roslyn/blob/master/src/ExpressionE...

Post reply on HN