mirror of
https://github.com/logos-messaging/sds-go-bindings.git
synced 2026-07-24 08:53:17 +00:00
sdsCall stored &wg (a pointer to a stack sync.WaitGroup) in C memory (SdsResp.ffiWg) and the result callback dereferenced it from the nim-ffi thread while the caller was parked in wg.Wait(). That violates the cgo pointer rules: the GC can relocate the parked goroutine's stack, leaving the C-held pointer dangling, which corrupts memory under GC pressure. Pass the WaitGroup as a runtime/cgo.Handle (a stable uintptr token) instead, and resolve it back to *sync.WaitGroup in the callback. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>