Skip to content

Remove unnecessary GC.Collect calls #11671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ private void EvaluateRequestStates()
[SuppressMessage("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods", MessageId = "System.GC.Collect", Justification = "We're trying to get rid of memory because we're running low, so we need to collect NOW in order to free it up ASAP")]
private void CheckMemoryUsage()
{
if (!NativeMethodsShared.IsWindows || BuildEnvironmentHelper.Instance.RunningInVisualStudio)
if (!NativeMethodsShared.IsWindows || BuildEnvironmentHelper.Instance.RunningInVisualStudio || Environment.Is64BitOperatingSystem)
{
// Since this causes synchronous I/O and a stop-the-world GC, it can be very expensive. If
// something other than build results is taking up the bulk of the memory space, it may not
Expand Down
2 changes: 1 addition & 1 deletion src/Build/BackEnd/Node/OutOfProcNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ private void CleanupCaches()
}

// Since we aren't going to be doing any more work, lets clean up all our memory usage.
GC.Collect();
// GC.Collect();
}

/// <summary>
Expand Down
Loading