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 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

I have a situation where an object A has a reference to object B.
I have a cache which has soft references to the cached objects. I am
The GoDiagram object model has a GoDocument. GoViews have a reference to a GoDocument.
When an object has various formats (XML,CSV) it can be represented in, where should
If an object has a property that is a collection, should the object create
Do you generally assume that toString() on any given object has a low cost
I have a database populated with 1 million objects. Each object has a 'tags'
How do I see if a certain object has been loaded, and if not,
I regularly want to check if an object has a member or not. An
We need to see what methods/fields an object has in Javascript.

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.