-
June 19th, 2006, 04:08 AM
#1
CoCreateInstanceEx memory leak
Hello,
I use CoCreateInstanceEx to instantiate an object on a remote computer.
And when the function call fails ( because the machine or the service is unvailable or anything else ), I can observe in the task manager a that the memory used by the process increases by about 4ko ( for each failed call ).
I can observe this phenomenum with W2000, but not with XP.
Does anybody know about this topic ? Is there a fix for W2000 ?
-
June 19th, 2006, 04:18 AM
#2
Re: CoCreateInstanceEx memory leak
First thing show your Code.without seeing your code not Possible to tell exact reason what's the wrong your are doing here. Second in your program use smart pointer . third use use ::CoInitialize() and ::CoUnInitialize() in your code.
Thanx
-
June 19th, 2006, 11:00 AM
#3
Re: CoCreateInstanceEx memory leak
Ok, here following is my code.
I just want to emphasis on that if the CoCreateInstanceEx call succeed there is no trouble i.e. no memory leak.
#include "windows.h"
#include "stdio.h"
#include "conio.h"
CLSID m_clsid;
void main( void )
{
CoInitialize(NULL);
HRESULT hr;
MULTI_QI qi[] = { &IID_IUnknown, NULL, S_OK };
COSERVERINFO srvInfo = {0, L"192.55.90.10", NULL, 0};
CLSIDFromString( L"{23459DE0-C53D-11D3-8BFF-00105AABB585}", &m_clsid );
while( !kbhit() )
{
hr = CoCreateInstanceEx(m_clsid, NULL, CLSCTX_REMOTE_SERVER, &srvInfo, 1, qi);
printf( "\r0x%08x 0x%08x %p %p ", hr, qi[0].hr, qi[0].pIID, qi[0].pItf );
if( qi[0].pItf )
qi[0].pItf->Release();
Sleep( 100 );
}
CoUninitialize();
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|