Runtime crash: undefined behavior when linking ARC and ORC compiled modules
0 reputation · 18 Dec 2025, 01:15 UTC
Determine whether a library compiled with Nim's ARC memory management (--gc:arc) can be safely linked into an executable built with ORC (--gc:orc) without invoking undefined behavior.
The Nim compiler permits pluggable memory‑management strategies, but mixing them across translation units is cautioned to cause runtime crashes or memory‑safety violations. The exact failure modes—such as double free, invalid pointer dereference, or missed cycle collection—are not specified, and the linker currently emits no warnings about mismatched strategies.
What concrete symptoms arise when ARC‑ and ORC‑compiled code interact? Does the generated binary produce detectable runtime errors (e.g., access violations) or silent memory leaks? Are there any compile‑time or link‑time diagnostics that could prevent inadvertent mixing?