[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

microsoft.public.dotnet.framework.interop

memory leak .. passing output string arg from C# to Managed C++

tintincat1977

2/2/2007 8:28:00 PM

I have the following sample code that is slowly leaking memory. Any
ideas?

TIA!
Tian

---
managed c++ code:
----------------

void foo::bar (String __gc * __gc *out_str)
{
//do something

//assign some "hard-coded" value to out_str
*out_str = Marshal::PtrToStringAnsi(static_cast<IntPtr>("test
string"));


}


----------------------------------------------

foo::bar() Called from C#
--------------------------

string s = null;
for(;;) {
afoo.bar(ref s);
}

----------------------------------

1 Answer

tintincat1977

2/2/2007 9:37:00 PM

0

Oops, I just now noticed that if I let it run long enough (like 20
mins or so), the memory usage stabilizes.

So, pls ignore my first post.