Reputation: 1267
I am new to golang, and I made a function which returns a map, but I do not know if it will cause a memory leak. the code like below
func ParseParams(data string) map[string]string {
params := strings.Split(data, "&")
m := make(map[string]string)
for idx := range params {
vals := strings.Split(params[idx], "=")
m[vals[0]] = vals[1]
}
return m
}
So, I would like to know if it is necessary to release or free the map ? or do something to avoid the memory leak. Thanks!
Upvotes: 0
Views: 329
Reputation: 6545
Go is garbage-collected so there is no possibility of a memory leak here.
Upvotes: 2