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 9235377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:01:02+00:00 2026-06-18T07:01:02+00:00

I have a List<> with about 800,000 objects in it. Once I’m done with

  • 0

I have a List<> with about 800,000 objects in it. Once I’m done with this list, I set it to null and then proceed with the rest of the routine.

The problem is the .NET’s garbage collector does not seem to be doing its job fast enough because when after setting this list to null, memory usage stays the same and I get “out of memory” exceptions.

Is there a way to wait on the garbage collector to finish its job ?

Perhaps I could redesign my program so I don’t load 800,000 items at once but this is for a one time running program that’s not going to be use in production at all.

Thanks!

  • 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-06-18T07:01:03+00:00Added an answer on June 18, 2026 at 7:01 am

    You could call:

    GC.Collect();
    GC.WaitForPendingFinalizers();
    //I have occasionally seen an extra call to GC.Collect() here
    

    However, I’d really only do this as a test to see if it helps and to establish if the GC is the problem.

    I’m assuming you have tested things in both Debug and Release modes.

    As a final note, you could potentially look at changing the GC Latency Mode.

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

Sidebar

Related Questions

I have a list of objects, this list contains about 4 million objects. there
I have a list of about 200,000 entities, and I need to query a
This is the scenario: I have a list of about 5000 URLs which have
We have a list of about 150,000 words, and when the user enters a
I have a list of about 10,000 staff members in a List<T> and I
I have a list of <ul> <li>blabla</li> <!-- About 800 or more in some
I have a List with about 20,000,000 entries. About 5,000,000 entries are unique. I
I have a list of about 200,000 IP addresses. I would like to link
I have list of objects that contain information about which classes static EventHandler should
I have a List of about 100 objects which just so happen to be

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.