?
Solved

MSXML IXMLHTTPRequest Memory Leak

Posted on 2001-07-16
7
Medium Priority
?
617 Views
Last Modified: 2008-02-26
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
Comment
Question by:danielj040300
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 6286326
>>Does anybody have a clue why and how to fix it?

How do you use 'vOpt'?
0
 
LVL 1

Expert Comment

by:MattC
ID: 6286428
listening.....
0
 
LVL 1

Author Comment

by:danielj040300
ID: 6288540
Sorry Left that one out.
It is declared as follow:
_variant_t vOpt("");

Thanks.
Daniel.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Accepted Solution

by:
MattC earned 400 total points
ID: 6289144
are you re-using the same "xml_request" object each time or do you re-instatiate it, without killing the old object?
0
 
LVL 1

Author Comment

by:danielj040300
ID: 6289178
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
 
LVL 11

Expert Comment

by:griessh
ID: 6846113
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
 
LVL 1

Expert Comment

by:Computer101
ID: 6846131
Listening,
Computer101
E-E Moderator
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question