Hi, I have a very complex C++ object (with many class members and some of them are shared between different objects).
What is the best way to measure how much memory this object takes?

I tried the following:
before and after creating this object I call
GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc))
and then use difference in pmc.WorkingSetSize between two calls.

However it doesn't work well since WorkingSetSize increased in balks. So sometimes I get a big memory increase and other times it is zero.

Is there any system function that allow to measure exactly how much memory was allocated between two calls?

Thanks in advance for help!

PS. I develop on Windows using Visual Studio