From: Josh Bleecher Snyder Date: Sat, 26 Aug 2017 13:55:34 +0000 (-0700) Subject: runtime: only clear key string's pointer in mapdelete_faststr X-Git-Tag: go1.10beta1~1320 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=dc10aeeff853c2156c1290144d5a004e03b91b76;p=gostls13.git runtime: only clear key string's pointer in mapdelete_faststr Change-Id: I0360d294868ec4423e4ae036009fac4e72425c9c Reviewed-on: https://go-review.googlesource.com/59152 Run-TryBot: Josh Bleecher Snyder TryBot-Result: Gobot Gobot Reviewed-by: Keith Randall --- diff --git a/src/runtime/hashmap_fast.go b/src/runtime/hashmap_fast.go index c378647892..f117311439 100644 --- a/src/runtime/hashmap_fast.go +++ b/src/runtime/hashmap_fast.go @@ -754,7 +754,8 @@ search: if k.str != key.str && !memequal(k.str, key.str, uintptr(key.len)) { continue } - *(*string)(kptr) = "" + // Clear key's pointer. + k.str = nil // Only clear value if there are pointers in it. if t.elem.kind&kindNoPointers == 0 { v := add(unsafe.Pointer(b), dataOffset+bucketCnt*2*sys.PtrSize+i*uintptr(t.valuesize))