protected static void GarbageCollectRandClr(REngine engine) { // it seems needed to call gc() twice to get a proper baseline. REngine.DoDotNetGarbageCollection(); engine.ForceGarbageCollection(); REngine.DoDotNetGarbageCollection(); engine.ForceGarbageCollection(); }