Manually disposing objects with API
-
Is there any way to manually dispose of an object using Windows API?
-
Is there any way to manually dispose of an object using Windows API?
Manually dispose of a managed (.NET Framework) object using the Windows API? No, you can't. This must be done by the CLR Garbage Collector otherwise you'll corrupt the CLR runtime and crash it. What's wrong with the .Dispose() method? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Manually dispose of a managed (.NET Framework) object using the Windows API? No, you can't. This must be done by the CLR Garbage Collector otherwise you'll corrupt the CLR runtime and crash it. What's wrong with the .Dispose() method? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Thanks. Dave Kreskowiak wrote: What's wrong with the .Dispose() method? I was using a System.Resources.ResourceSet object for a large resource file, and when I called it's .Dispose() or it's .Close() method, it wouldn't free the memory used by it, even after GC.Collect() on then next line. I finally figured out to assign the value Nothing to it, which freed the memory used by it. Kyle
-
Thanks. Dave Kreskowiak wrote: What's wrong with the .Dispose() method? I was using a System.Resources.ResourceSet object for a large resource file, and when I called it's .Dispose() or it's .Close() method, it wouldn't free the memory used by it, even after GC.Collect() on then next line. I finally figured out to assign the value Nothing to it, which freed the memory used by it. Kyle
Kyle Edwards wrote: even after GC.Collect() on then next line Don't call the GC Collect method unless you specifically know what you doing and why. When the GC Collects, it has to wait for ALL threads running under the .NET Framework to pause. This CAN take a LOOOOOOONG time to do. Only when all the threads are paused can the GC safely do it's job. When it's done, all the threads are resumed. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome