Click here to Skip to main content
13,041,887 members (64,551 online)
Rate this:
Please Sign up or sign in to vote.
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 21-Nov-11 20:27pm
Mehdi Gholam339.2K

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Methods are stored once - you don't change them so they are effectively static objects: only one instance per class.
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 22 Nov 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100