On Wednesday, 24 January 2018 at 21:48:21 UTC, Nordlöw 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. I'm aware of
extern(C++), having one word overhead, but such
extern(C++)-classes cannot use all of D; I get compilation
errors such as
node.d(99,25): Error: Internal Compiler Error: type
`inout(Edge)[]` can not be mapped to C++
One pointer for the vtbl, one for the monitor, not sure what the
other one is.
C++ classes have one pointer for the vtbl at offset of -1
size_t.sizeof
Declaring that particular method as extern(D) will fix that
problem.