EXCEPINFO excepInfo;
memset(&excepInfo, 0, sizeof excepInfo);
UINT nArgErr = (UINT)-1;
HRESULT hr = pDispatch->Invoke(id, IID_NULL, LOCALE_USER_DEFAULT, wFlags,
pDispParams, pVarResult, &excepInfo, &nArgErr);
IErrorInfo* perrinfo = 0;
_com_handle_excepinfo(excepInfo, &perrinfo);
if (FAILED(hr)) {
SetErrorInfo(0, perrinfo);
}
But I do not see the memory leak if I pass in NULL for &excepInfo and
&nArgErr. Has anyone else seen this occur? or is there is a fix out for it?
I have the latest service packs, the COM+ rollup and I am using win2000.
Thanks
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnic...@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
<no...@none.com> wrote in message news:eie3M44nCHA.2444@TK2MSFTNGP10...
This is not my code, this is microsoft's code which is automatically
generated using the __raise compiler statement. You can see this stepping
through the __raise code in a disassembler.
If this struct does contain embedded BSTRS, then the free code will need to
be added into the __ComInvokeEventHandler() function which is in the ATL
source code.
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnic...@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
<no...@none.com> wrote in message news:OdLIZ38nCHA.2396@TK2MSFTNGP08...
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnic...@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
<no...@none.com> wrote in message news:OdLIZ38nCHA.2396@TK2MSFTNGP08...
__raise MyFunc()
All other code is generated by the compiler.
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnic...@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
<no...@none.com> wrote in message news:#ypJS3HoCHA.2312@TK2MSFTNGP10...
===================
But I do not see the memory leak if I pass in NULL for &excepInfo and
&nArgErr.
===================
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnic...@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
<no...@none.com> wrote in message news:ectejGIoCHA.2312@TK2MSFTNGP12...
>
> I looked and expinfo, and all members of exepinfo are NULL so VB 6 is not
> returning any BSTR's to free.
>
> But it still leaks quite well. I attached a sample project, but I do not
> know if it will go to the newsgroup properly. I also sent the project to
> your email address.
>
> "Alexander Nickolov" <agnic...@mvps.org> wrote in message
> news:#ecjI9HoCHA.1536@tkmsftngp02...
By visual inspection, I do not see a place where a leak would occur and I am
guessing it is somewhere inside VB 6.
Whenever I press the "LeakMe" button in the sample project I sent you it
leaks approx. 4 MB of memory. The "LeakMe" button triggers 100000
connection point events each time you hit it. I have tested the sample code
on 20 different windows 2000 machines with different levels of service packs
and the program leaks in every case.
>But I do not see the memory leak if I pass in NULL for &excepInfo and
>&nArgErr.
It means the following code does not cause a memory leak:
HRESULT hr = pDispatch->Invoke(id, IID_NULL, LOCALE_USER_DEFAULT, wFlags,
pDispParams, pVarResult, NULL, NULL );
But the following code does cause a memory leak:
HRESULT hr = pDispatch->Invoke(id, IID_NULL, LOCALE_USER_DEFAULT, wFlags,
pDispParams, pVarResult, &excepInfo, &nArgErr);
"Alexander Nickolov" <agnic...@mvps.org> wrote in message
news:#FW#rsIoCHA.1896@tkmsftngp04...
CComVariant varResult;
T* pT = static_cast<T*>(this);
int nConnectionIndex;
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections;
nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
VariantClear(&varResult);
DISPPARAMS disp = { NULL, NULL, 0, 0 };
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD,
&disp, &varResult, NULL, NULL);
}
}
return varResult.scode;
This code does not leak at all in VB 6 service pack 5.
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnic...@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
<no...@none.com> wrote in message news:uWiJBAJoCHA.2332@TK2MSFTNGP08...
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnic...@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
<no...@none.com> wrote in message news:uGn6EUToCHA.2540@TK2MSFTNGP12...
> This also leaks in C#, I included a sample C# project in the ZIP file.
>
> If you cant read the zip file from the newsgroup, let me know and I can sent
> it directly to you.
>
> As of yet, I have not tested with a ATL client, but my guess is the ATL
> client would not leak. In my opinion this is a serious enough problem in C#
> and VB that it warrents fixing (unless its already fixed and I missed it, or
> unless I'm doing something really stuipd!).
>
> Who can I send this to in microsoft, maybe I can get a free t-shit or
> something if it turns out to be a bug :)
>
>
>
>
"Alexander Nickolov" <agnic...@mvps.org> wrote in message
news:OlSotfUoCHA.2292@tkmsftngp02...
Thanks,
Santhosh
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
©2002 Microsoft Corporation. All rights reserved.