Maoni0 / realmon

A monitoring tool that tells you when GCs happen in a process and some characteristics about these GCs
MIT License
281 stars 25 forks source link

Session Leaks on Ctrl+C #30

Closed MokoSan closed 2 years ago

MokoSan commented 2 years ago

There are instances where if the user clicks Ctrl+C to close realmon, the session isn't getting disposed.

Repro Steps

  1. Run realmon normally and note the session name by putting a break point here.
  2. Ctrl+C to close the session.
  3. Open up a command line prompt / powershell in admin mode.
  4. logman query -ets to list all the sessions on the machine. Here is where I found the session still exists even after exiting the process.

Eventually, this will result in the following exception: Unhandled exception. System.Runtime.InteropServices.COMException (0x800705AA): Insufficient system resources exist to complete the requested service. (0x800705AA).

Solution

Subscribe to the Console.CancelKeyPress event and explicitly dispose the session.

Maoni0 commented 2 years ago

fixed by #31