P/Invoke memory leakage
-
Hi all, I p/Invoke a VC++ dll in C#, but there is serious memory leak, how can I fix the memory leakage by the VC++ dll caused by P/Invoke ? (the leakage seem not come from the internal C++ code inside the dll, so I suspect it come from the loading and unloading of the dll in C#) Thanks
-
Hi all, I p/Invoke a VC++ dll in C#, but there is serious memory leak, how can I fix the memory leakage by the VC++ dll caused by P/Invoke ? (the leakage seem not come from the internal C++ code inside the dll, so I suspect it come from the loading and unloading of the dll in C#) Thanks
Hi! If it were like you say everybody would have serious problems using P/invoke. I think it's very unlikely for the P/invoke mechanism to create memory leaks the dll itself doesn't. The first time you call a p/invoke function, the containing DLL is loaded and as soon as the class you declared the function in goes out of scope (usually when unloading the AppDomain), the DLL is released. What exactly are the signatures of your functions and your DllImport declarations? mav