-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
Nim Version
Nim Compiler Version 2.2.2 [Windows: amd64]
Compiled at 2025-02-06
Copyright (c) 2006-2025 by Andreas Rumpf
active boot switches: -d:release
Description
According to the nim 2.2.2 stdlib system website example, it can't be compiled. If adding the pragmas {.nimcall, gcsafe.} then re-compiling it, the Error: 'handleOOM' is not GC-safe as it accesses 'gOutOfMem' which is a global using GC'ed memory was thrown.
var gOutOfMem: ref OutOfMemDefect #EOutOfMemory
new(gOutOfMem) # need to be allocated *before* OOM really happened!
gOutOfMem.msg = "out of memory"
proc handleOOM() =
raise gOutOfMem
system.outOfMemHook = handleOOMCurrent Output
>nim c -d:release oomhook
Hint: used config file '..\.choosenim\toolchains\nim-2.2.2\config\nim.cfg' [Conf]
Hint: used config file '..\.choosenim\toolchains\nim-2.2.2\config\config.nims' [Conf]
.......................................................................
..\oomhook.nim(8, 23) Error: type mismatch: got 'proc ()' for 'handleOOM' but expected 'proc (){.nimcall, gcsafe.}'
Pragma mismatch: got '{..}', but expected '{.gcsafe.}'.
Expected Output
Compiling passes.
Known Workarounds
No response
Additional Information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels