I have been looking for this for sometime now. But is it seriously not possible to delete / unset / free a variable or a part of memory ?
As per the spec there is only one function delete to delete the key of a map ?
But what to do I would like to free the value of strucure element
Lets say I have a structure :type MyStruct struct {d []int}
v []int
I have been looking for this for sometime now. But is it seriously not possible to delete / unset / free a variable or a part of memory ?
As per the spec there is only one function delete to delete the key of a map ?
But what to do I would like to free the value of strucure element
Lets say I have a structure :type MyStruct struct {d []int}
v []int
If you're done with it (and there are no more references to it), you don't
/need/ to free it (although there are cases where you want to keep itaround and re-use it. But I think all you'd need here ismystruct = MyStruct{}
--
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...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
No, you would have overwritten mystruct 100 times.
I think you are getting off on the wrong foot. GC has been around since LISP in the 50's, all these problems have been discussed, understood and solved decades ago. Java is garbage collected, ruby is garbage collected, JavaScript is garbage collected, etc.This is both not something to worry about, and also not something you can do anything about, Garbage collecting is integral to Go.
Maybe, but I still feel having an option to free memory anytime alongwith the GC would be a better solution. I love the GC, but something to free the memory would always be handy.