Hi All,
I am having a terrible problem with the garbage collector of the .NET
run-time.
My mangaged code(c#) application sends a System.String object to an unmanged
world COM client function
The COM client is exposed to my C# application by wrapping it in a class
with _gc keyword(e.g public _gc class DotNetWrapper).
In the Wrapper, the function returns a String*, which is nothing but a BSTR
returned from the COM client.
So ultimately in my C# application i have a pointer to a String object.
And as i send and receive response in a loop, garbage collection does not
seem to be happening and my
machine just takes more than 300MB and then hangs.
If i explicitly call System.gc.Collect(), even then memory cleanup is done
only randomly and not immediately.
If i write a C++ client to access my COM object, i can do a ::SysFreeString
on the BSTR to immediately free the memory.
Could anyone suggest a solution for this.
Thanks
Vinu