Alex Rivera | Logout

.NET: What is typical garbage collector overhead?

Asked 2010-02-15T16:37:16.630
11

5% of execution time spent on GC? 10%? 25%?

Thanks.

Edit
Report

1 Answer

0

Yes, the Garbage Collector will spend some X% of time collecting when averaged over all applications everywhere. But that doesn't necessarily means that time is overhead. For overhead, you can really only count the time that would be left after releasing an equivalent amount of memory on an unmanaged platform.

With that in mind, the actual overhead is negative, but the Garbage collector will save time by release several chunks of memory in batches. That means fewer context switches and an overall improvement in efficiency.

Additionally, starting with .Net 4 the garbage collector does a lot of it's work on a different thread that doesn't interrupt your currently running code as much. As we work more and more with mutli-core machines where a core might even be sitting idle now and then, this is a big deal.

answered 2010-02-15T17:08:37.910

Your Answer