从stringto转换为[]byte分配新内存是真的吗?另外,从[]byteto转换是否会string分配新的内存?
s := "a very long string"
b := []byte(s) // does this doubled the memory requirement?
b := []byte{1,2,3,4,5, ...very long bytes..}
s := string(b) // does this doubled the memory requirement?
相关分类