The program I'm running has a thread per websocket. Running valgrind --tool=massif showed the websockets were using most of the memory. The websocket library I use is niv. This is with the ORC mm.
When I use -d:useMalloc as a Nim compile flag, the leak is gone. For now I'm not planning to trace the leak any further. Could this be from an ORC mm bug?
You might be running into this: https://forum.nim-lang.org/t/7653#48533
Nim has its own free pool that OS does not know about. OS might think memory is increasing but its just the internal free pool getting bigger.
I know, I just thought that perhaps someone had experienced the same issue and would recognize it >quickly. The issue Treeform mentioned comes close to something like that. I'll see what I can do to >create a minimal reproducible program for the issue.
ORC/ARC seem to have problems with foreign threads. As you are using websockets there is a chance that you have some signal handling/callbacks where threads are created by the OS/Runtime system which Nim doesn't know about. What you are experiencing sounds like this problem as you eventually run out of memory.
I suggest you use -d:useMalloc until this issue with ARC/ORC has been dealt with.