From: Sasha Melentyev Date: Sat, 3 Sep 2022 18:56:43 +0000 (+0000) Subject: runtime/pprof: set labelMap length X-Git-Tag: go1.20rc1~1000 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=0857633f8b4ca4b28aad160d1dd1dbb1fe5a4d7d;p=gostls13.git runtime/pprof: set labelMap length Change-Id: If09094e72161f2c5da9102706781524e32f87782 GitHub-Last-Rev: 89949bc6ee8622be31c4e4db45ea6da11fd9053f GitHub-Pull-Request: golang/go#54855 Reviewed-on: https://go-review.googlesource.com/c/go/+/428234 Auto-Submit: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Reviewed-by: Cherry Mui TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor --- diff --git a/src/runtime/pprof/label.go b/src/runtime/pprof/label.go index 0c58a7ac47..d39e0ad58e 100644 --- a/src/runtime/pprof/label.go +++ b/src/runtime/pprof/label.go @@ -57,8 +57,8 @@ func (l *labelMap) String() string { // WithLabels returns a new context.Context with the given labels added. // A label overwrites a prior label with the same key. func WithLabels(ctx context.Context, labels LabelSet) context.Context { - childLabels := make(labelMap) parentLabels := labelValue(ctx) + childLabels := make(labelMap, len(parentLabels)) // TODO(matloob): replace the map implementation with something // more efficient so creating a child context WithLabels doesn't need // to clone the map.