Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6002241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:56:59+00:00 2026-05-23T00:56:59+00:00

I’m having an issue in my application where I am seeing an excessive amount

  • 0

I’m having an issue in my application where I am seeing an excessive amount of Gen 2 Garbage Collections. From what I’ve been reading it sounds like a good ratio of Gen0 : Gen1 : Gen2 collections should be 100:10:1. I am getting very close to 1:1:1. Every collection seems to be a Gen2 collection. I’ve been trying to track down the cause of this, but I’m not having much luck. Things I’ve tried:

  1. Used .NET Memory Profiler to see what objects are being created. I had the Perfmon open showing me the Size of the Gen 2 Heap and I tried to take snapshots when it was low and when it was high and then compare the difference. This was partially successful. Then % Time in GC seems to be lower, but there are still as many Gen2 collections as Gen1.

  2. I disabled a major feature in my application and found that it was what was causing the issue. Not sure how this helps, but I thought I’d mention that I have a general idea where in my code the issue is.

  3. I tried other tools as well. Red Gate Memory Profiler. That didn’t help much either.

So here are my questions:

  1. What causes the CLR to perform a Gen2 collection over Gen0 or Gen1? I have been reading that it could be the LOH, but I’ve confirmed this is not my issue.

  2. What other troubleshooting techniques should I use?


Edit: 6/6/2011

It looks to be related to calling System.Diagnostics.PerformanceCounterCategory.GetInstanceNames(). We have a thread that collects various performance counters. It looks like this eventually calls down to a registry read of HKEY_PERFORMANCE_DATA and a value of “230”. This looks to be the “Process” category. The data that gets returned is a byte array that is 65000 bytes. Although this is smaller than 85000, it seems like something here is getting put on the LOH. I put a breakpoint in WinDbg on “mscorwks!svr::gc_heap::allocate_large_object”.


Edit: 6/7/2011

It for sure is related to getting performance counter data frequently. It is getting byte arrays that are 130,000 bytes just to read on value from the counter. And since I’m doing this frequently, it creating lots of Gen2 collections since they are all going into the LOH. I was thinking using P/Invoke statements to get the counter values instead.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:57:00+00:00Added an answer on May 23, 2026 at 12:57 am

    It turned out that I didn’t need to read those performance counter values. I just removed them and things are much better.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.