I have MSXML2::IXMLDOMNodeList interface.
I can find the common length of all MSXML2::IXMLDOMNode-s from this list using such code:
MSXML2::IXMLDOMNode* pDOMXMLNode = 0;
BSTR NodeText;
ULONG lValueSize = 0;
ULONG lCommonLength = 0;
while(pDOMXmlNodeList->nextNode(&pDOMXMLNode)== S_OK)
{
pDOMXMLNode->get_xml(&NodeText);
CString strNode(NodeText);
lValueSize += strNode.GetLength();
}
lCommonLength += lValueSize;
It is good, but it is not what i want to find: i want to determine object instance’s size in memory.
Is there a way to make it in C++?
I’m not sure if you can determine exact size of COM object. However, you can use the following trick to determine approximate size of COM objects.
Microsoft provides some API to determine the memory state of the program. Here is how you apply the above technique to Microsoft API:
The object
differencetells the size of COM object. You can print its value as:Or, you can further analyse the object
differencewhich is of type_CrtMemStatedefined as:Read the documentation at MSDN: