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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:44:37+00:00 2026-05-15T12:44:37+00:00

If an object has 5 references can that object find out what is referenced

  • 0

If an object has 5 references can that object find out what is referenced to him?
Because I know that Java (and hopefully C#) have a list of that for the GC.

  • 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-15T12:44:38+00:00Added an answer on May 15, 2026 at 12:44 pm

    No, there’s no “list of references”. The GC doesn’t need to know everything that references an object – it just needs to know if anything references an object.

    As a very crude model of what the GC does, it marks every object in the heap as garbage, then looks at objects which it knows to be non-garbage (“root” objects). For example, it will look at the stack of each thread and for each instance method in the thread, it will usually1 mark the target instance as non-garbage.

    Then it will go through each of those roots, and see what objects those ones refer to… and mark them as non-garbage. It will recurse down, finding everything it can. Whatever hasn’t been marked as non-garbage can then be collected (or finalized).

    As you can see from this algorithm, the GC doesn’t need to keep a full list of references for each object – just a bit to say “garbage” or “non-garbage”.

    Obviously in reality the GC is much more complicated than this, in both Java and .NET, with generational garbage collectors and various strategies to minimise the GC “pause” and use multiple threads for GC. Hopefully this simplified view is enough to explain why even the GC doesn’t have a list of references though.


    1 Not always, in the case of .NET. An object can be garbage collected while an instance method is still running “in” it, if that method doesn’t refer to any fields in the object from the current point onwards.

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

Sidebar

Related Questions

In the ADO.Net Entity Framework, I have an object which has 4 references to
Q. Is there a way to find out if an object has any "strong
I have read every where that primitive datatype and object references are passed by
In my example, I'm trying to create a new object which has references to
the window.open() object has some funky parameter list... is there a way to do
If my object has a protected List<String> fileNote; What is the right way to
I'm getting AttributeError: 'NoneType' object has no attribute 'encode' error when parsing out some
This figure again shows that every object has a prototype. Constructor function Foo also
I have an object which has one field- double[] _myField it's hashcode is public
I noticed that the PHP session_decode() function has an object type for PHP reference

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.