Solved

MSXML IXMLHTTPRequest Memory Leak

Posted on 2001-07-16
7
545 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
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 1

Accepted Solution

by:
MattC earned 200 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now