19

Is there any change in .Net 4.0 garbage collector execution?

sth
  • 222,467
  • 53
  • 283
  • 367
web dunia
  • 9,381
  • 18
  • 52
  • 64

5 Answers5

12

Here's a blog posting:

Link

and

http://www.infoq.com/news/2009/06/Background-Collector

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
ScottE
  • 21,530
  • 18
  • 94
  • 131
3

There is also AppDomainResourceManager feature, which allows you to track resource usage ( Memory and CPU ) per appdomain. the GC part of this feature is the ability to get per appdomain memory tracking.

mfawzymkh
  • 4,030
  • 1
  • 16
  • 12
3

There's also an ephemeron implemenation using a new class called System.Runtime.CompilerServices.ConditionalWeakTable which is detailed here.

This is useful for collecting dynamic languages which allow setting arbitary "properties" on arbitrary instances.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Doug McClean
  • 14,265
  • 6
  • 48
  • 70
  • Out of curiosity, do you know of any other classes that use ephemerons? For example, if it's desirable to create a single link from object `X` to object `Y`, is there any way to do so other than creating a `ConditionalWeakTable` instance for the purpose of holding one single link? – supercat Jun 19 '12 at 15:26
  • @supercat For that there has been [`System.WeakReference`](http://msdn.microsoft.com/en-us/library/system.weakreference.aspx) since .Net 1.0. – Doug McClean Jun 19 '12 at 16:07
  • When I say a "link" from `X` to `Y`, I mean that the system will consider `Y` to have a strong rooted reference if such a reference exists to `X`, without `X` itself having to hold a reference to `Y`. In .net 4.0, `Y` could create such a reference from `X` to itself by having a `ConditionalWeakTable myCWT` field, and performing `myCWT.Add(X, this);`. Creating a table for the purpose of holding one item, though, seems like it would be wasteful unless the run-time cost of creating a single such item would be comparable to that of creating a table. – supercat Jun 19 '12 at 16:29
2

Also, check out the blog of the developer who works on the GC, where there is an article about the new GC, plus a link to a Channel 9 interview regarding the .NET 4.0 GC.

Jason Evans
  • 28,906
  • 14
  • 90
  • 154
2

Yes, lots.

My latest book Visual F# 2010 for Technical Computing includes a lot of performance-related information about .NET 4 as well as F# itself and the performance measurements and advice are quite different with .NET 4 and the new background garbage collector. In many cases we're seeing substantial performance improvements but there are some slowdowns as well.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
J D
  • 48,105
  • 13
  • 171
  • 274