G
Guest
Hi,
I've got a problem and I haven't found any solution in the web till now. I'm
using MSXML4.0SP2 with VC6 creating large XML files. The (only) problem I've
got is the not-existing release of memory. My app allocs more and more memory
and gives no back.
I've build a small code part explaining my problem:
CoInitialize(NULL);
CoCreateInstance(__uuidof(DOMDocument40),
NULL,
CLSCTX_INPROC_SERVER,
__uuidof(IXMLDOMDocument2),
(void**)&pDOMDoc),
"Create a new DOMDocument";
m_pDOMDoc->load(_variant_t("1.xml"),0);
IXMLDOMElement *pEl;
m_pDOMDoc->get_documentElement(&pEl);
for(int i= 0; i<500; i++)
{
IXMLDOMElement *pElb;
m_pDOMDoc->createElement(_bstr_t("B1"), &pElb);
pElb->setAttribute(_bstr_t("b1"),_variant_t("2"));
pEl->appendChild(pElb,NULL);
//pElb->Release(); //OPTIONAL, OP EFFECT ?!?
}
m_pDOMDoc->save(_variant_t("1.xml"));
//pEl->Release(); //Optional, no effect!!
m_pDOMDoc->Release();
delete m_pDOMDoc;
CoUninitialize();
That's it! I create a simple XML Document ...
<A1>
<B1 b1="2" />
<B1 b1="2" />
<B1 b1="2" />
... 500 times ...
<B1 b1="2" />
</A1>
Before loading I've used 1,4MB, after load 1,7MB, after saving 1,8MB ...
after releasing (or/and) couninitializing still 1,8MB. Why? Shouldn't the
memory be released? The CoUninitializing function ist just for fun, because
i'm using more than one XML file and I can't throw the library away, still
using it for other objects.
Please Help, Mayday
Greetz from Mainz
Mathew
I've got a problem and I haven't found any solution in the web till now. I'm
using MSXML4.0SP2 with VC6 creating large XML files. The (only) problem I've
got is the not-existing release of memory. My app allocs more and more memory
and gives no back.
I've build a small code part explaining my problem:
CoInitialize(NULL);
CoCreateInstance(__uuidof(DOMDocument40),
NULL,
CLSCTX_INPROC_SERVER,
__uuidof(IXMLDOMDocument2),
(void**)&pDOMDoc),
"Create a new DOMDocument";
m_pDOMDoc->load(_variant_t("1.xml"),0);
IXMLDOMElement *pEl;
m_pDOMDoc->get_documentElement(&pEl);
for(int i= 0; i<500; i++)
{
IXMLDOMElement *pElb;
m_pDOMDoc->createElement(_bstr_t("B1"), &pElb);
pElb->setAttribute(_bstr_t("b1"),_variant_t("2"));
pEl->appendChild(pElb,NULL);
//pElb->Release(); //OPTIONAL, OP EFFECT ?!?
}
m_pDOMDoc->save(_variant_t("1.xml"));
//pEl->Release(); //Optional, no effect!!
m_pDOMDoc->Release();
delete m_pDOMDoc;
CoUninitialize();
That's it! I create a simple XML Document ...
<A1>
<B1 b1="2" />
<B1 b1="2" />
<B1 b1="2" />
... 500 times ...
<B1 b1="2" />
</A1>
Before loading I've used 1,4MB, after load 1,7MB, after saving 1,8MB ...
after releasing (or/and) couninitializing still 1,8MB. Why? Shouldn't the
memory be released? The CoUninitializing function ist just for fun, because
i'm using more than one XML file and I can't throw the library away, still
using it for other objects.
Please Help, Mayday
Greetz from Mainz
Mathew