mirror of
https://github.com/logos-messaging/nim-ffi.git
synced 2026-06-24 02:09:32 +00:00
ffiNewReq derived the request id with `let typeStr = $T`, allocating a
Nim GC string on the *calling* thread for every request. Embedded in a
foreign host (e.g. Go) the callers are transient, concurrent OS threads;
running Nim's GC there corrupts the heap under load. The type name is
known at compile time, so emit it as a `cstring` literal (the same value
already used as the registry key) — no runtime allocation. Applies to
both the {.ffi.} and {.ffiCtor.} request builders.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>