A simple command line tool that shows how to call the .NET garbage collector for an external process. All relevant code is in GCHelper.cs and could be trivially moved to other libraries or tools (it depends on the Microsoft.Diagnostics.Tracing.TraceEvent package only).
Usage:
EtwForceGC.exe <PID>
This tool was "inspired" by some sources: