4 ms·
import "C" import "Unsafe" is all you need for manual memory management and pointer arithmetic with Go. Since the GC is fairly light and snappy, I find it's
by rahen 4y ago
import "C"
import "Unsafe"
is all you need for manual memory management and pointer arithmetic with Go.
Since the GC is fairly light and snappy, I find it's best of both world to only resort to Unsafe for the performance critical parts, and leave the GC deal with the rest.
For more serious performance requirements, consider using jemalloc:
https://dgraph.io/blog/post/manual-memory-management-golang-jemalloc/ https://dgraph.io/blog/post/manual-memory-management-golang-...