The performance tests should run the following before snapshotting working set:
C#
GC.Collect();
GC.RunPendingFinalizers();
GC.Collect();
The fix isn't that simple unfortunately. The code you linked runs in the driving console process, not devenv.exe.
There's actually a command called "Tools.ForceGC" that does a GC - assuming we have access to DTE out of proc in the console app, we should be able to run that command.
Forcing a GC is well understood best practice in APEX. There is support for this in APEX here. It uses the DTE apis as @davkean describes
fixed by AB#186458