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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:34:20+00:00 2026-05-12T08:34:20+00:00

Ok this is potentially a noob question but here goes. Is it possible to

  • 0

Ok this is potentially a noob question but here goes.

Is it possible to “outrun” the garbage collector?

The reason I ask is because I have a recursive method that gets run several times during some event in my application (by several I mean around 60 times per second and the event goes on for an indefinite amount of time, even minutes). The problem is that in each loop of the recursive method, I create a fairly complex object (TreeViewItem with some mods we need for the project AND another complex object that works as the DataContext for the TreeViewItem), so my concern is that these TreeViewItems stay in the heap when the recursive method runs, so when the garbage collector kicks in, it doesn’t clean them; and possibly, the next time the recursive method starts, it stacks some more TreeViewItem, and the garbage collector never catches up.

The problem is that we have a memory leak, and we’re looking for the culprit.

Any help really appretiated

  • 1 1 Answer
  • 1 View
  • 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-12T08:34:20+00:00Added an answer on May 12, 2026 at 8:34 am

    No, you can’t make the garbage collector leak by overloading it.

    The way that the garbage collector works actually makes it handle situations like yours rather well.

    If you remove a reference to a large complex of objects, it will not collect the objects one at a time. It sees that none of the objects have any active references any more and it will collect the whole bunch of objects at once.

    Most objects are short lived, so the garbage collector is built to handle that efficiently. If you for example have filled the first generation heap, and 90% of the objects are to be collected, the garbage collector doesn’t remove the 90%. Instead it moves the 10% to the next generation and simply wipes the first generation.

    If the garbage collector still finds itself with a lot of work to do, it will just do it, and you will have to wait for it. It freezes your threads while it’s working, and they simply won’t run until the garbage collector is done.

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

Sidebar

Related Questions

a noob question here. I have the following code: - (IBAction)selectExistingPicture { if ([UIImagePickerController
Caveat: I realize this is potentially a server configuration question, but I thought there
This is mostly just out of curiosity, and is potentially a silly question. :)
This could potentially be a dumb question so apologies in advance if it is.
I'm new to EF so please excuse me if this is a noob question.
OK, as a preface this question potentially is 'stupider' than my normal level of
I've asked a similar question before, but I've done some more research and this
derived from this question , is it possible to use HQL or Criteria for
To show, for example.... USER@SID > I thought this was potentially helpful to a
I can see some potential difficulties with this concept but the idea is: I

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.