[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

SAFFEARRAY And Compac Framework leak

TheSebaster

7/31/2007 1:36:00 PM

I am trying to consume those 2 safe array into a
c# compac framework application without leaking.

This is the server side methode I am calling:
interface IArrayDataAccess : IDispatch{
[id(1), helpstring("method Get1")] HRESULT Get1([out] SAFEARRAY(LONG)*
_data, [out] SAFEARRAY(CHAR)* _state);
};

And this is the implementation:
STDMETHODIMP CArrayDataAccess::Get1(SAFEARRAY** _data, SAFEARRAY** _state)
{
SAFEARRAYBOUND ArrayBoundaries;
ArrayBoundaries.lLbound = 0;
ArrayBoundaries.cElements = 1000 * 1000 * 1000;

*_data = ::SafeArrayCreate(VT_I4, 1, &ArrayBoundaries);
*_state = ::SafeArrayCreate(VT_UI1, 1, &ArrayBoundaries);

return S_OK;
}

AND this is the C# CF test Application than consume it:
...
Array arData;
Array arState;

objIArrayDataAccess.Get1(out arData, out arState);
System.Diagnostics.Debug.WriteLine("Get: " + lSeq++);

arData = null;
arState = null;
...

The probleme is that under the compac framework, the call to Get1 methode
leak and there is no leak with the same project under win32. Anyone could
help me??
I use the compac framework 2 with latest update and fix.