diff options
Diffstat (limited to 'lib/core/runtime_v2.nim')
-rw-r--r-- | lib/core/runtime_v2.nim | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/core/runtime_v2.nim b/lib/core/runtime_v2.nim index fe4bf37bf..aa2511ce4 100644 --- a/lib/core/runtime_v2.nim +++ b/lib/core/runtime_v2.nim @@ -71,13 +71,14 @@ proc nimIncRef(p: pointer) {.compilerRtl, inl.} = proc nimRawDispose(p: pointer) {.compilerRtl.} = when not defined(nimscript): - when hasThreadSupport: - let hasDanglingRefs = atomicLoadN(addr head(p).rc, ATOMIC_RELAXED) != 0 - else: - let hasDanglingRefs = head(p).rc != 0 - if hasDanglingRefs: - cstderr.rawWrite "[FATAL] dangling references exist\n" - quit 1 + when defined(nimOwnedEnabled): + when hasThreadSupport: + let hasDanglingRefs = atomicLoadN(addr head(p).rc, ATOMIC_RELAXED) != 0 + else: + let hasDanglingRefs = head(p).rc != 0 + if hasDanglingRefs: + cstderr.rawWrite "[FATAL] dangling references exist\n" + quit 1 when defined(useMalloc): c_free(p -! sizeof(RefHeader)) else: |