Commit dc10aeef authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

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 <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarKeith Randall <khr@golang.org>
parent 8adaf685
...@@ -754,7 +754,8 @@ search: ...@@ -754,7 +754,8 @@ search:
if k.str != key.str && !memequal(k.str, key.str, uintptr(key.len)) { if k.str != key.str && !memequal(k.str, key.str, uintptr(key.len)) {
continue continue
} }
*(*string)(kptr) = "" // Clear key's pointer.
k.str = nil
// Only clear value if there are pointers in it. // Only clear value if there are pointers in it.
if t.elem.kind&kindNoPointers == 0 { if t.elem.kind&kindNoPointers == 0 {
v := add(unsafe.Pointer(b), dataOffset+bucketCnt*2*sys.PtrSize+i*uintptr(t.valuesize)) v := add(unsafe.Pointer(b), dataOffset+bucketCnt*2*sys.PtrSize+i*uintptr(t.valuesize))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment