Class instance memory overhead lower than 3 words?

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Jan 24 21:47:26 UTC 2018


On Wed, Jan 24, 2018 at 09:48:21PM +0000, Nordlöw via Digitalmars-d-learn wrote:
> Why is the memory overhead for a class instance as high as 3 words (24
> bytes on 64-bit systems? I find that annoyingly much for my knowledge
> database application.
[...]

There's been an attempt to get rid of the Monitor field, which takes up
one word, but it didn't seem to have gone anywhere the last time it was
discussed.  I believe originally it was always initialized, but lately
it seems to have been changed to be lazily initialized, so at least
you'll only incur the computational cost if you actually use it.
Nevertheless, the field itself is still there.


T

-- 
What is Matter, what is Mind? Never Mind, it doesn't Matter.


More information about the Digitalmars-d-learn mailing list