TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

.NET Garbage Collector Basics and Performance Hints (2003)

85 pointsby vikas0380over 8 years ago

8 comments

alkonautover 8 years ago
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.<p>Most GC churn in most applications (I would think) is down to Linq and collection use.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;roslyn&#x2F;blob&#x2F;master&#x2F;src&#x2F;ExpressionEvaluator&#x2F;Core&#x2F;Source&#x2F;ResultProvider&#x2F;Helpers&#x2F;ArrayBuilder.cs" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;roslyn&#x2F;blob&#x2F;master&#x2F;src&#x2F;ExpressionE...</a>
yreadover 8 years ago
I wonder how much of the advice is still important with the improvements .NET GC has received over the decades [1] [2]<p>[1] <a href="http:&#x2F;&#x2F;scottdorman.github.io&#x2F;2008&#x2F;11&#x2F;07&#x2F;clr-4.0-garbage-collection-changes&#x2F;" rel="nofollow">http:&#x2F;&#x2F;scottdorman.github.io&#x2F;2008&#x2F;11&#x2F;07&#x2F;clr-4.0-garbage-coll...</a><p>[2] <a href="https:&#x2F;&#x2F;blogs.msdn.microsoft.com&#x2F;dotnet&#x2F;2012&#x2F;07&#x2F;20&#x2F;the-net-framework-4-5-includes-new-garbage-collector-enhancements-for-client-and-server-apps&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blogs.msdn.microsoft.com&#x2F;dotnet&#x2F;2012&#x2F;07&#x2F;20&#x2F;the-net-f...</a>
评论 #13365720 未加载
jconleyover 8 years ago
Back in 2005-2006 we ran into significant issues with the GC and pinned memory related to Windows sockets when building a networked server for XMPP. I believe the GC has improved since then for that scenario, but it was a big surprise when it happened. It was a classic case of a leaky abstraction.<p><a href="http:&#x2F;&#x2F;blog.jdconley.com&#x2F;2006&#x2F;06&#x2F;how-to-build-scalable-net-server.html" rel="nofollow">http:&#x2F;&#x2F;blog.jdconley.com&#x2F;2006&#x2F;06&#x2F;how-to-build-scalable-net-s...</a>
评论 #13367289 未加载
algorithmsRcoolover 8 years ago
For those interested in more details about .NET garbage collector here is some reading.<p>Garbage Collection Overview<p><a href="https:&#x2F;&#x2F;msdn.microsoft.com&#x2F;en-us&#x2F;library&#x2F;0xy59wtx(v=vs.110).aspx" rel="nofollow">https:&#x2F;&#x2F;msdn.microsoft.com&#x2F;en-us&#x2F;library&#x2F;0xy59wtx(v=vs.110)....</a><p>Fundamentals of garbage collection<p><a href="https:&#x2F;&#x2F;msdn.microsoft.com&#x2F;en-us&#x2F;library&#x2F;ee787088(v=vs.110).aspx" rel="nofollow">https:&#x2F;&#x2F;msdn.microsoft.com&#x2F;en-us&#x2F;library&#x2F;ee787088(v=vs.110)....</a><p>Visualising the .NET Garbage Collector<p><a href="http:&#x2F;&#x2F;mattwarren.org&#x2F;2016&#x2F;06&#x2F;20&#x2F;Visualising-the-dotNET-Garbage-Collector&#x2F;" rel="nofollow">http:&#x2F;&#x2F;mattwarren.org&#x2F;2016&#x2F;06&#x2F;20&#x2F;Visualising-the-dotNET-Garb...</a><p>Clr Book of the runtime : Garbage Collection<p><a href="https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;coreclr&#x2F;blob&#x2F;master&#x2F;Documentation&#x2F;botr&#x2F;garbage-collection.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;coreclr&#x2F;blob&#x2F;master&#x2F;Documentation&#x2F;...</a><p>Maoni Stephen&#x27;s Blog<p><a href="https:&#x2F;&#x2F;blogs.msdn.microsoft.com&#x2F;maoni" rel="nofollow">https:&#x2F;&#x2F;blogs.msdn.microsoft.com&#x2F;maoni</a><p><a href="https:&#x2F;&#x2F;blogs.msdn.microsoft.com&#x2F;maoni&#x2F;2004&#x2F;06&#x2F;15&#x2F;using-gc-efficiently-part-1&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blogs.msdn.microsoft.com&#x2F;maoni&#x2F;2004&#x2F;06&#x2F;15&#x2F;using-gc-e...</a><p><a href="https:&#x2F;&#x2F;blogs.msdn.microsoft.com&#x2F;maoni&#x2F;2004&#x2F;09&#x2F;25&#x2F;using-gc-efficiently-part-2&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blogs.msdn.microsoft.com&#x2F;maoni&#x2F;2004&#x2F;09&#x2F;25&#x2F;using-gc-e...</a><p><a href="https:&#x2F;&#x2F;blogs.msdn.microsoft.com&#x2F;maoni&#x2F;2004&#x2F;12&#x2F;19&#x2F;using-gc-efficiently-part-3&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blogs.msdn.microsoft.com&#x2F;maoni&#x2F;2004&#x2F;12&#x2F;19&#x2F;using-gc-e...</a><p><a href="https:&#x2F;&#x2F;blogs.msdn.microsoft.com&#x2F;maoni&#x2F;2005&#x2F;05&#x2F;06&#x2F;using-gc-efficiently-part-4&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blogs.msdn.microsoft.com&#x2F;maoni&#x2F;2005&#x2F;05&#x2F;06&#x2F;using-gc-e...</a><p>There is also a refactoring effort to standardize the GC&lt;-&gt;EE interface<p><a href="https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;coreclr&#x2F;projects&#x2F;3" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;coreclr&#x2F;projects&#x2F;3</a><p>I would link to the source code of the GC itself, but it&#x27;s a single 35KSLOC file.
mysterydipover 8 years ago
This is timely as I&#x27;m troubleshooting a .NET app with randomly long garbage collection times. I&#x27;m just the sysadmin in this scenario, without access to the code, so I&#x27;m approaching it from Splunk and AppDynamics. If anyone has suggestions beyond this article, I&#x27;d appreciate it :)
评论 #13367099 未加载
gus_massaover 8 years ago
This article is from 2003.
评论 #13364707 未加载
jstimpfleover 8 years ago
It&#x27;s &quot;.NET&quot; Garbage collector, not &quot;Net&quot;.
评论 #13367661 未加载
osdover 8 years ago
This is a really weird article. It manages to &quot;cover&quot; a huge amount of ground while simultaneously saying pretty much nothing.
评论 #13365097 未加载