Translation of Golang gc from C to Go