Debugging Memory Usage in Nim

2023-03-16 Thread zevv
A few weeks ago I made this little tool for fun to visualize memory usage for multi threaded programs: it injects a little LD_PRELOAD lib overriding malloc() and friends and draws all allocations in a 2D hilbert projection of the heap; nice to get a "feel" of what your program is doing, also fun

Debugging Memory Usage in Nim

2023-03-16 Thread tanelso2
Valgrind was the ticket. Very easy to use Massif to find exactly what was growing unbounded over time.

Debugging Memory Usage in Nim

2023-03-05 Thread noah
+1 for valgrind, dead simple usage. All my tests were passing until I added valgrind and it caught bunches of mem leaks

Debugging Memory Usage in Nim

2023-02-27 Thread jasonfi
Valgrind also has a tool called massif which can be used to track memory allocations:

Debugging Memory Usage in Nim

2023-02-27 Thread tanelso2
I haven't found my problem yet but the valgrind suggestion works and looks like it will help. Running a series of tests and I'll analyze the valgrind results in the morning. Thanks, @zevv!

Debugging Memory Usage in Nim

2023-02-27 Thread zevv
When on Linux: compile with `--debugger:native -d:useMalloc`, put in a `quit()` somewhere and run your program on valgrind; when the process exists valgrind will tell you exactly which memory has been allocated where. Example: type Foo = ref object val: int proc flop

Debugging Memory Usage in Nim

2023-02-27 Thread tanelso2
I found and that looks like it will help.

Debugging Memory Usage in Nim

2023-02-27 Thread tanelso2
I have a Nim application that hits OOM limits on Linux. I would like to know what objects are taking up all of that memory so I know what to modify. What would be the recommended way to debug this? Application is compiled with `mm:orc` I saw references to a Heap Dump in old versions of the nim