}
}
- if (logger.IsVerbose)
- logger.LogMessage($"Emitting debug information");
-
// Native side of the object writer is going to do more native memory allocations.
// Free up as much memory as possible so that we don't get OOM killed.
// This is potentially a waste of time. We're about to end the process and let the
// OS "garbage collect" the entire address space.
- var gcMemoryInfo = GC.GetGCMemoryInfo();
- if (gcMemoryInfo.TotalCommittedBytes > gcMemoryInfo.TotalAvailableMemoryBytes / 2)
+ var gcInfo = GC.GetGCMemoryInfo();
+
+ if (logger.IsVerbose)
+ logger.LogMessage($"Memory stats: {gcInfo.TotalCommittedBytes} bytes committed, {gcInfo.TotalAvailableMemoryBytes} bytes available");
+
+ if (gcInfo.TotalCommittedBytes > gcInfo.TotalAvailableMemoryBytes / 5)
{
if (logger.IsVerbose)
logger.LogMessage($"Freeing up memory");
GC.Collect(GC.MaxGeneration, GCCollectionMode.Aggressive);
}
+ if (logger.IsVerbose)
+ logger.LogMessage($"Emitting debug information");
+
objectWriter.EmitDebugModuleInfo();
succeeded = true;