I can reproduce the issue with latest devel. This a likely a bug in the default GC. (refc)
you can use --gc:markAndSweep to try an alternative garbage collector. see: [https://nim-lang.org/docs/nimc.html#compiler-usage-command-line-switches](https://nim-lang.org/docs/nimc.html#compiler-usage-command-line-switches) for a list of potential arguments for the compiler
