#Is the backing array used in calls to `unsafe.Slice()` always ignored by the GC?

6 messages · Page 1 of 1 (latest)

winged spoke
#

GC in Golang use mark - clean process, if you convert an array from C pointer, GC will not mark it because the memory is not alloced by Golang runtime, thus the array will not be freed by the GC

#

GC does not care about type, type system only exists in your code or things works with interface, GC only care about the addresses

#

yes you are right

#

Go runtime knows which address did it alloced, if it detected any address not under its control, it will just ignore them

#

if you problem is solved, please type /solved in chat, thanks!

winged spoke