Click here to Skip to main content
15,892,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How is a object stored in memory?

Are the properties (public/private) stored apart from the methods

(i.e. data apart from the executing code, one copy of the method definition IL code)

Or bundles are stored separately (i.e. data and method IL code stored together).

This could have huge memory implications if you need to store a lot of objects and the latter is correct so it would be beneficial to separate the data and have pure data objects and one data handler code.
Posted

1 solution

Methods are stored once - you don't change them so they are effectively static objects: only one instance per class.
 
Share this answer
 
Comments
Mehdi Gholam 22-Nov-11 3:26am    
Does this mean that the internal data portions of the class are stored apart from the method definitions for that class?
OriginalGriff 22-Nov-11 3:39am    
Yes - the code portions are not stored on the heap at all - they are in a totally different memory area.
Mehdi Gholam 22-Nov-11 3:46am    
Ah, but how many copies 1 or as many as the objects created?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900