diff options
| author | Russ Cox <rsc@golang.org> | 2017-02-17 00:10:39 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2017-02-24 20:15:56 +0000 |
| commit | cbab65fdfa1cf74f65a480de0447388286169f26 (patch) | |
| tree | 380e6aebc8e472edc6e27f0815a275958f895e99 /src/os/exec/exec_test.go | |
| parent | 322fff8ac855390dc2a2876e9051a8dd526d2c6a (diff) | |
| download | go-cbab65fdfa1cf74f65a480de0447388286169f26.tar.xz | |
runtime/pprof: add streaming protobuf encoder
The existing code builds a full profile in memory.
Then it translates that profile into a data structure (in memory).
Then it marshals that data structure into a protocol buffer (in memory).
Then it gzips that marshaled form into the underlying writer.
So there are three copies of the full profile data in memory
at the same time before we're done. This is obviously dumb.
This CL implements a fully streaming conversion from
the original in-memory profile to the underlying writer.
There is now only one copy of the profile in memory.
For the non-CPU profiles, this is optimal, since we have to
have a full copy in memory to start with.
For the CPU profiles, we could still try to bound the profile
size stored in memory and stream fragments out during
the actual profiling, as Go 1.7 did (with a simpler format),
but so far that hasn't been necessary.
Change-Id: Ic36141021857791bf0cd1fce84178fb5e744b989
Reviewed-on: https://go-review.googlesource.com/37164
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Diffstat (limited to 'src/os/exec/exec_test.go')
0 files changed, 0 insertions, 0 deletions
