Can two new objects point to the same memory address in GoLang?
https://www.pixelstech.net/article/1554529174-Can-two-new-objects-point-to-the-same-memory-address-in-GoLang [www.pixelstech.net]
2019-04-27 20:10
This is because the memory allocation on heap calls the newobject function in runtime package. newobject function would invoke mallocgc function to allocate memory. This function is a bit special and it has some logic to check whether an object is indeed occupying memory or not, if no memory is needed, the address of zerobase(a global variable) will be assigned to it. In the above example snippet, both a and c are empty struct which doesn’t need memory. Hence both a and c are having the same memory address which is the address of zerobase.
source: L