In gc:arc mode (but not other modes), a tuple let breaks memory safety/management
import strutils
proc procStat() =
for line in lines("/proc/stat"):
let cols = line.splitWhitespace(maxSplit=1)
echo cols[0] #To see Num loops
let (nm, rest) = (cols[0], cols[1]) #This breaks stuff
# let nm = cols[0]
# let rest = cols[1]
# let col = rest.splitWhitespace #Works WITHOUT tuple let
procStat()
cpu0
cpu1
Traceback (most recent call last)
/u/cb/s/nim/mrve6.nim(10) mrve6
/usr/lib64/nim/lib/system/iterators.nim(5) procStat
/usr/lib64/nim/lib/system/alloc.nim(968) dealloc
/usr/lib64/nim/lib/system/alloc.nim(867) rawDealloc
/usr/lib64/nim/lib/system/avltree.nim(74) del
cpu0
cpu1
.
.
.
cat /proc/stat > dummy
scp dummy
change path from /proc/stat -> dummy
$ nim -v
Nim Compiler Version 1.1.1 [Linux: amd64]
Compiled at 2020-02-08
Copyright (c) 2006-2019 by Andreas Rumpf
git hash: e4415422fe2b615a6dfe01bb7136ec41ef429108
active boot switches: -d:release -d:useLinenoise -d:nativeStackTrace -d:nimHasLibFFI
```
I have a fix for this one
Most helpful comment
I have a fix for this one