622532364d
Today dump info generates the entire JSON string in memory before writing it out to disk. The JSON encoder supports chunked conversion so we can do partial writes to disk and keep less of the output in memory. When converting chunks the encoder writes to the sink a lot so we also need a buffering layer to limit the number of writes. For large programs the dump info output can be almost 2GB. After some testing a buffer size of 500MB seems to consistently reduce memory consumption by ~3.5GB. Note: This stacks with the changes in https://dart-review.googlesource.com/c/sdk/+/322843 to reduce memory consumption by 4.8GB on a local build (18.3GB -> 13.5GB). Change-Id: Id8f359af0724c3925f2ff767caee80d949c46da9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323040 Reviewed-by: Mayank Patke <fishythefish@google.com> Commit-Queue: Nate Biggs <natebiggs@google.com>