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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:34:02+00:00 2026-06-08T12:34:02+00:00

I was wondering , An Instance of class is on the Heap. ( value

  • 0

I was wondering ,

An Instance of class is on the Heap. ( value types inside it are also in the heap).

But what about the opposite case ?

There is one question here but it didn’t mention any GC related info.

So – How does GC handle this situation ?

public struct Point 
{
object o ;

   public int x, y;

   public Point(int p1, int p2) 
   {
   o = new Object();
      x = p1;
      y = p2;    
   }
}
  • 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-08T12:34:03+00:00Added an answer on June 8, 2026 at 12:34 pm

    Point includes a reference to an object on the heap. This will become eligible for collection as soon as no more copies of that Point exist with that reference. Noting that:

    Point p1 = new Point(1,2);
    Point p2 = p1;
    

    is 2 copies, each with a reference to the same object on the heap. If those points are stored as fields on an object somewhere, then obviously the lifetime of the object will be at least as long as the object with those fields. If those points are only variables on the stack, then it gets more complex, because the GC may take into account whether a variable is ever read again. If it isn’t, the variable might not effectively exist (or: it might).

    The path can be very indirect, but it essentially comes down to: can GC get to the object, starting from the GC roots.

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

Sidebar

Related Questions

I was wondering how I would go about accessing one instance of a class,
Im just wondering how I go about saving an instance of a class to
I've been wondering about the way to get both class and instance methods into
I was wondering if there was a way for an instance of a class
I was wondering that when I create an instance of a class template with
I was wondering if it is allowed to create an instance of a class
I just wondering how I could replace the second instance of a string inside
Using a Singleton class guarantees one instance of a class to give control to
I am just wondering if there is any best way to initialize the class
I am wondering if it's better to pass an instance of a whole class

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.