How much memory is used by an object?

Alexandr Druzhinin drug2004 at bk.ru
Mon Feb 18 06:19:16 PST 2013


18.02.2013 20:54, bearophile пишет:
> Alexandr Druzhinin:
>
>> so I need some way to know how much memory is used by some object to
>> improve the app. How can I do it?
>
>> I've used some OS specific things but they aren't convenient because
>> provide information about the whole application, instead of the
>> specific class instance. Simple size calculation of class fields
>> doesn't correspond to memory consumption.
>
> Try:
> http://dlang.org/traits.html#classInstanceSize
>
> Also, the GC has some useful hooks.
>
> Bye,
> bearophile

Thanks a lot!
Also, what hooks do you mean? I look at core.memory and don't see 
anything like hooks... I'd appreciate this information.


More information about the Digitalmars-d-learn mailing list