Let's say I have a simple map with string as keytype and a self-defined struct as valuetype. Like this: map[string]*struct
I populate this map with a lot of different values and a lot of these values will never be used again after a certain period of time.
So I wasn't sure whether the golang garbage collector will clean up my map for me or I need to do it myself. Then I came across this answer on a different question: Is it safe to remove selected keys from Golang map within a range loop?
This makes it look like the garbage collector won't do it for me and my only solution is to set my map to nil if i want to free up some memory every now and then.
Is this true? Or is there another way to do it without losing values in my map that are not 'inactive'?