1
確實從string
轉換爲[]byte
分配新內存?另外,是否從[]byte
轉換爲string
分配新的內存?有關從Golang []字節和字符串轉換的技術
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?