Skip to content

Commit b785f7d

Browse files
mkustermannCommit Bot
authored and
Commit Bot
committed
Avoid logging information by-default and never discarding such logs
The analyzer wraps various functionality in logging calls like await logger.runAsync('Prepare linked bundles', () async { ... }); Doing so will cause time being measured and begin/end messages to be written to a log. Those strings accumulate in a `StringBuffer` that is never accessed. For example running analyzer on a big app like flutter can cause thousands of "--- Prepare linked bundles in 0 ms. " strings to be generated and hanged on to. This CL makes us no longer generate such strings - only if the creator of a context supplies a [PerformanceLog] explicitly (in which case it is responsible for draining the messages written to it). This reduces memory consumption when analyzing flutter by around 3 MB. TEST=ci Change-Id: I4979a964f13c63bd2a3cccef97fb702431731139 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254925 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Martin Kustermann <kustermann@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
1 parent 74be55a commit b785f7d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: pkg/analyzer/lib/src/dart/analysis/context_builder.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class ContextBuilderImpl implements ContextBuilder {
8181
}
8282

8383
byteStore ??= MemoryByteStore();
84-
performanceLog ??= PerformanceLog(StringBuffer());
84+
performanceLog ??= PerformanceLog(null);
8585

8686
if (scheduler == null) {
8787
scheduler = AnalysisDriverScheduler(performanceLog);

0 commit comments

Comments
 (0)