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

  • SEARCH
  • Home
  • 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 387581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:41:13+00:00 2026-05-12T15:41:13+00:00

In my application there is a specific time when a number of large objects

  • 0

In my application there is a specific time when a number of large objects are all released at once. At that time I would like to do a garbage collection on specifically the large object heap (LOH).

I’m aware that you cannot do that, you must call GC.Collect(2) because the GC is only invoked on the LOH when it is doing a generation 2 collection. However, I’ve read in the documentation that calling GC.Collect(2) would still run a GC on generations 1 and 0.

Is it possible to force the GC to only collect gen 2, and not include gen 1 or gen 0?

If it is not possible, is there a reason for the GC to be designed that way?

  • 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-12T15:41:14+00:00Added an answer on May 12, 2026 at 3:41 pm

    It’s not possible. The GC is designed so that a generation 2 collection always also collects generation 0 and 1.

    Edit: Found you a source for this on a GC developer’s blog:

    Gen2 GC requires a full collection
    (Gen0, Gen1, Gen2 and LOH! Large
    objects are GC’ed at every Gen2 GC
    even when the GC was not triggered by
    lack of space in LOH. Note that there
    isn’t a GC that only collects large
    objects.) which takes much longer than
    younger generation collections.

    Edit 2: From the same blog’s Using GC Efficiently Part 1 and Part 2 apparently Gen0 and Gen1 collections are fast compared to a Gen2 collection, so that it seems reasonable to me that only doing Gen2 wouldn’t be of much performance benefit. There might be a more fundamental reason, but I’m not sure. Maybe the answer is in some article on that blog.

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

Sidebar

Related Questions

Some where in the application there is an autogenerated query like SELECT DISTINCT `Name`,`Number`
I'm developing an asp.net application that has some potentially large data tables. I would
Is there anyway I can use to destroy my deployed application at specific date?.
In my application user can add there reminder for the specific day and reminder
Straighforward question really Wondering if there was an application specific for handling coldfusion log
Basically, I have a large number of C structs to keep track of, that
I'd like to create a web service that an application server can contact to
I made an application that needs to handle specific keyboard presses even when the
Is there a maximum number of times that a DLL can be registered and
I have an MVC2 web application that needs to record the number of unique

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.