I read more carefully the unsafe.Pointer rules and noticed that I had made a mistake here, converting a uintptr to a unsafe.Pointer has to be done within a single expression, otherwise the GC may not know that the pointer is referenced and may mistakenly reclaim the memory.
Nothing much to review here, I just wanted to share the knowledge.
I read more carefully the unsafe.Pointer rules and noticed that I had made a mistake here, converting a
uintptr
to aunsafe.Pointer
has to be done within a single expression, otherwise the GC may not know that the pointer is referenced and may mistakenly reclaim the memory.Nothing much to review here, I just wanted to share the knowledge.