danielj040300
asked on
MSXML IXMLHTTPRequest Memory Leak
I use the following code repeatedly to get responses from a server but the object leaks memory a lot. Does anybody have a clue why and how to fix it?
Daniel.
CComPtr<IXMLHTTPRequest> xml_Request;
HRESULT hr = xml_Request.CoCreateInstan ce( L"Msxml2.XMLHTTP.3.0", NULL, CLSCTX_INPROC_SERVER );
if( hr != S_OK )
{
AfxMessageBox("Could not create the XMLDOMHttpRequest object");
return;
}
hr = xml_Request->open( L"POST", _bstr_t( (LPCTSTR)strUrl.c_str() ), _variant_t(false),
_variant_t(""), _variant_t(""));
if(hr != S_OK)
{
AfxMessageBox("Error open connnection");
return;
}
hr = xml_Request->send(vOpt);
if(hr != S_OK)
{
AfxMessageBox("Error posting");
return;
}
Daniel.
CComPtr<IXMLHTTPRequest> xml_Request;
HRESULT hr = xml_Request.CoCreateInstan
if( hr != S_OK )
{
AfxMessageBox("Could not create the XMLDOMHttpRequest object");
return;
}
hr = xml_Request->open( L"POST", _bstr_t( (LPCTSTR)strUrl.c_str() ), _variant_t(false),
_variant_t(""), _variant_t(""));
if(hr != S_OK)
{
AfxMessageBox("Error open connnection");
return;
}
hr = xml_Request->send(vOpt);
if(hr != S_OK)
{
AfxMessageBox("Error posting");
return;
}
listening.....
ASKER
Sorry Left that one out.
It is declared as follow:
_variant_t vOpt("");
Thanks.
Daniel.
It is declared as follow:
_variant_t vOpt("");
Thanks.
Daniel.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I tries it using the whole block and only from "xml_Request->open()" but no luck. The memory leak only occurs after the 30th or so loop.
CComPtr do call the Release() method after it goes out of scope.
Thanks.
Daniel.
CComPtr do call the Release() method after it goes out of scope.
Thanks.
Daniel.
I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days.
I am not sure what to suggest here. Could somebody please shed some light on the value of this thread ... otherwise it was suggested to delete and refund.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
I am not sure what to suggest here. Could somebody please shed some light on the value of this thread ... otherwise it was suggested to delete and refund.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
Listening,
Computer101
E-E Moderator
Computer101
E-E Moderator
How do you use 'vOpt'?