Skip to content

Commit

Permalink
Unconditionally clear the syscall cache at the end of the build.
Browse files Browse the repository at this point in the history
The syscall cache is cleared each time there's memory pressure [1]. However, some entries may be left in the cache between the last clearing and the end of the build. These entries don't add much value since they are cleared at the beginning of the next build.

This CL performs a "flushing" of the syscall cache at the end of the build (independent of the memory pressure) to get rid of these entries and reduce the overall retained heap.

[1] https://github.com/bazelbuild/bazel/blob/30afc2547713907c06ad7ece65442215710154dd/src/main/java/com/google/devtools/build/lib/skyframe/HighWaterMarkLimiter.java#L63

PiperOrigin-RevId: 520626069
Change-Id: I53ea923c1868e90bfcf43950a4c685601f1197fe
  • Loading branch information
joeleba authored and copybara-github committed Mar 30, 2023
1 parent 2aa06cf commit 9353955
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,7 @@ public void notifyCommandComplete(ExtendedEventHandler eventHandler) throws Inte
memoizingEvaluator.noteEvaluationsAtSameVersionMayBeFinished(eventHandler);
progressReceiver.globDeps = new ConcurrentHashMap<>();
globFunction.complete();
clearSyscallCache();
}

/**
Expand Down Expand Up @@ -1349,7 +1350,6 @@ public void preparePackageLoading(
starlarkSemantics.getBool(BuildLanguageOptions.EXPERIMENTAL_SIBLING_REPOSITORY_LAYOUT));
setPackageLocator(pkgLocator);

clearSyscallCache();
this.pkgFactory.setGlobbingThreads(executors.globbingParallelism());
this.pkgFactory.setMaxDirectoriesToEagerlyVisitInGlobbing(
packageOptions.maxDirectoriesToEagerlyVisitInGlobbing);
Expand Down

0 comments on commit 9353955

Please sign in to comment.