w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Avoid memory leak in c# client of a unmanaged DLL with memory leak

According to my theory, this changes nothing. In C#/managed, nothing much different will happen than if you'd load a DLL into a native program. The DLL will allocate heap memory and since that resource belongs to the process it will persist, even if the DLL is unloaded.

Things would change if you'd have a purely managed DLL. You could then load it into an app domain and dispose the DLL alltogether with the App-Domain...

So solutions? The hard way would be similar to the 64-Bit Process with 32-Bit DLL Problem. Create a separate process, load the DLL and do remote calls. This is cumbersome but if it is only a vew calls, it may be worth it.

Other: Not that I know of but fixing the DLL's code.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.