Discussion:
E_OUTOFMEMORY on GetIdsOfNames/Invoke
(too old to reply)
Leon Finker
2006-01-25 12:58:46 UTC
Permalink
Hi,

Has anyone experienced E_OUTOFMEMORY when making a cross process/DCOM call
through IDispatch interface on win2k? Exact same code works fine on NT4(SP6)
and winxp. I'm 100% sure that the machine is not out of memory (perfmon).
This is under VPC. What are other conditions when E_OUTOFMEMORY is returned
from IDispatch? does anyone know? Thanks a lot!
Kim Gräsman
2006-01-25 20:47:22 UTC
Permalink
Hi Leon,
Post by Leon Finker
Has anyone experienced E_OUTOFMEMORY when making a cross process/DCOM
call through IDispatch interface on win2k? Exact same code works fine
on NT4(SP6) and winxp. I'm 100% sure that the machine is not out of
memory (perfmon). This is under VPC. What are other conditions when
E_OUTOFMEMORY is returned from IDispatch? does anyone know? Thanks a
lot!
No straight ideas, but if you were to pass a wide-char string argument where
a BSTR is expected, I guess E_OUTOFMEMORY could be provoked from the marshalling
layer, because it peeks at the DWORD preceding the pointer, and attempts
to reallocate it for marshalling.

What can you tell us about the specific method call?

--
Best Regards,
Kim Gräsman
Leon Finker
2006-01-26 02:44:04 UTC
Permalink
Hi Kim,

This is the exact code:

DISPID dispid;
LPOLESTR lpsz = L"CreateApplication";

//CComDispatchDriver m_Controller;
hr = m_Controller->GetIDsOfNames( IID_NULL, &lpsz, 1,
LOCALE_USER_DEFAULT, &dispid );

This is exact code. So, hr is E_OUTOFMEMORY. Then I tried to call Invoke()
with hardcoded values and same HRESULT.

BTW, I installed SP1 on that VPC and still same problem. Then I installed
SP3 and SP4 and no error happens anymore. No error on WinXP. The pointer is
called through on a correctly COM (OleInitialize) initialized thread and the
pointer is retrieved through GIT from another COM (MTA) initialized thread.
It even works on NT4 SP6 (VPC machine). It's always reproducible on that
win2k-KO VPC machine. I didn't spend huge amount debugging this yet. I
thought maybe someone can spot an error or encountered this before.

Thanks a lot!
Post by Kim Gräsman
Hi Leon,
Post by Leon Finker
Has anyone experienced E_OUTOFMEMORY when making a cross process/DCOM
call through IDispatch interface on win2k? Exact same code works fine
on NT4(SP6) and winxp. I'm 100% sure that the machine is not out of
memory (perfmon). This is under VPC. What are other conditions when
E_OUTOFMEMORY is returned from IDispatch? does anyone know? Thanks a
lot!
No straight ideas, but if you were to pass a wide-char string argument
where a BSTR is expected, I guess E_OUTOFMEMORY could be provoked from the
marshalling layer, because it peeks at the DWORD preceding the pointer,
and attempts to reallocate it for marshalling.
What can you tell us about the specific method call?
--
Best Regards,
Kim Gräsman
Kim Gräsman
2006-01-28 10:04:03 UTC
Permalink
Hi Leon,
Post by Leon Finker
This is exact code. So, hr is E_OUTOFMEMORY. Then I tried to call
Invoke() with hardcoded values and same HRESULT.
Hmm... Nothing jumps out at me.

I take it the call never reaches the remote object? That would indicate that
the problem is either in your code or in the proxy implementation for IDispatch
on that particular platform.

Any difference if you make the method name allocated on the stack instead
of the data segment:

OLECHAR lpsz[] = L"CreateApplication";

?

I guess since Invoke is problematic as well, this shouldn't be the issue,
but I've seen cases where GetIDsOfNames would try and modify the LPOLESTR
passed to it (it adjusts case in the same buffer), and if it was in read-only
memory, things would break.

--
Best Regards,
Kim Gräsman

Loading...