Is an object stored in the heap when it is an a class instance variable, and in the stack when it’s a function variable? Is that correct?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
References are stored on stack(Not in all case though)
Note: Only for local variables. For instance and class variables, they are part of the object, hence, on the heap.
While Objects are stored on heap.