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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:09:11+00:00 2026-05-29T09:09:11+00:00

There are two scenario that i trying to understand how will GC will act

  • 0

There are two scenario that i trying to understand how will GC will act

1- There is two object – object1 and object2
object1 has reference on object2 and object2 has reference on object1
Now, both of those object are not in use and GC can collect them.

What will happened ? does GC skip on this collection ? ?

2- Same question but we have 4 ( or n ) objects that have reference on each other.
What GC will do on this case ???

  • 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-29T09:09:12+00:00Added an answer on May 29, 2026 at 9:09 am

    The GC used by .NET is a tracing garbage collector (“Mark and Sweep” is a related term)

    Memory objects are considered “garbage” if they can no longer be reached by following pointers/references from the non-garbage part of your program’s memory.

    To determine what is reachable and what is not, the GC first establishes a set of root references/pointers. Those are references that are guaranteed to be reachable. Examples include local variables and static fields.

    It then follows these references recursively (traces) and marks each object it encounters as “not garbage”. Once it runs out of references to follow, it enters the “sweep” phase where every object that has not been marked as “non garbage” is freed (which might include invoking the object’s finalizer).

    So as soon as none of the objects in your “object ring” is referenced by any part of your “live” objects, it will be garbage collected.

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

Sidebar

Related Questions

It seems to me that there are two scenarios in which to use JOINs:
I've been playing around trying to thoroughly understand Reference and Value types. Just when
I have a scenario like this: There are two tables table1 and table2 .
I am trying to understand the performance of a query that I've written in
I'm attempting to create a contacts application that has two main entities - person
I'm trying to figure out how to configure my project such that JPA will
I was wondering which of these two scenario's works best for swapping between 2
There are two scenarios I need to clarify: An executable compiled with .NET 3.5
I have two distinct scenarios. One, where there is a many to many case,
There are two weird operators in C#: the true operator the false operator If

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.