www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: A monitor for every object

reply bearophile <bearophileHUGS lycos.com> writes:
Steven Schveighoffer:

 Most of the time the extra word isn't noticed  
 because the memory size of a class is usually not exactly a power of 2.

I'd like to know in a normal object oriented program how much memory this design actually wastes. Thank you to you and Kagamin for your answers, bye, bearophile
Feb 04 2011
parent "Robert Jacques" <sandford jhu.edu> writes:
On Fri, 04 Feb 2011 16:02:55 -0500, bearophile <bearophileHUGS lycos.com>  
wrote:

 Steven Schveighoffer:

 Most of the time the extra word isn't noticed
 because the memory size of a class is usually not exactly a power of 2.

I'd like to know in a normal object oriented program how much memory this design actually wastes. Thank you to you and Kagamin for your answers, bye, bearophile

1 word per object, assuming a uniform distribution of object sizes. Yes, _most_ objects aren't affected, but the ones that are make up for the difference by using twice the ram.
Feb 04 2011