github.com/pidato/unsafe@v0.1.4/memory/rpmalloc/cmd/main.go (about) 1 package main 2 3 // #include <stdlib.h> 4 import "C" 5 import ( 6 "github.com/pidato/unsafe/memory" 7 "runtime" 8 "time" 9 ) 10 11 func main() { 12 memory.Init() 13 14 for i := 0; i < 2; i++ { 15 go func() { 16 runtime.LockOSThread() 17 memory.Free(memory.AllocZeroed(128)) 18 C.free(C.malloc(128)) 19 time.Sleep(time.Second * 5) 20 }() 21 } 22 23 time.Sleep(time.Hour) 24 }