On Saturday, October 22, 2016 at 4:57:52 PM UTC+8, T L wrote: > > > The string struct used internally is > > type stringStruct struct { > str unsafe.Pointer > len int > } > > When following f function is called and s is cleared, > how do go runtime knows the starting memory address of the old s.str is > "a" instead of "c"? >
I mean how do go runtime knows "abcdefg" instead of "cde" should be released. > > var s = "abcdefg"[2:5] // s.str should point at "c". > > func f() { > s = "" > } > > > -- 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.