Is it possible, to say the gc to collect during debugging session via Visual Studio 2015 Enterprise?
I want to observe the memory usage of my application when calling GC.Collect()
, but only for some debugging reasing. So calling it from Visual Studio during debugging the app would be very helpful.
Thank you very much!
To force a garbage collection, use the hotkey: Ctrl+Alt+Shift+F12, Ctrl+Alt+Shift+F12 (press it twice). If forcing garbage collection reliably makes your scenario work, file a report through the Visual Studio feedback tool as this behavior is likely to be a bug.
You can force garbage collection either to all the three generations or to a specific generation using the GC. Collect() method.
Garbage collection (GC) is a memory recovery feature built into programming languages such as C# and Java. A GC-enabled programming language includes one or more garbage collectors (GC engines) that automatically free up memory space that has been allocated to objects no longer needed by the program.
You can write GC.Collect()
in the Immediate Window.
During a breakpoint you can use the "immediate window" to issue commands, just do a GC.Collect()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With