[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 642
  • Last Modified:

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.CoCreateInstance( 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;
}
0
danielj040300
Asked:
danielj040300
1 Solution
 
jkrCommented:
>>Does anybody have a clue why and how to fix it?

How do you use 'vOpt'?
0
 
MattCCommented:
listening.....
0
 
danielj040300Author Commented:
Sorry Left that one out.
It is declared as follow:
_variant_t vOpt("");

Thanks.
Daniel.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
MattCCommented:
are you re-using the same "xml_request" object each time or do you re-instatiate it, without killing the old object?
0
 
danielj040300Author Commented:
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.
0
 
griesshCommented:
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

0
 
Computer101Commented:
Listening,
Computer101
E-E Moderator
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now