With slices, you can do

slice = slice[:0]

to remove the values from the slice, but keep the backing slice with the 
same capacity (although the elements aren't marked for GC I believe, if 
that's a concern). With maps, is there a similar pattern? I've tried:

for key := range m {
 delete(m, key)
}

But this doesn't seem to work, I still see allocations (and it causes a 
significant performance hit, which makes sense).

Even something similar to https://golang.org/cl/137880043 if we had to 
clear the actual values would be great.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to