Are you using async await in your program?

In any case, the best way I've found to diagnose memory leaks for long-running 
programs is by logging the memory usage of each object to something like 
prometheus. My [prometheus package](https://github.com/dom96/prometheus) can do 
that automatically for you, but you'll need to set it up and have a web server 
running in your process for it to work properly. If you're not using async then 
this probably isn't the best approach.

You can alternatively just print out the same data that my package collects, 
see how I do this here: 
[https://github.com/dom96/prometheus/blob/master/src/prometheus/collectors/gccollector.nim#L84](https://github.com/dom96/prometheus/blob/master/src/prometheus/collectors/gccollector.nim#L84).
 The dumpHeapInstances function gives you the raw data, but there is one that 
returns a human-readable string as well if you look around. You can just call 
it to get how much memory each type is using.

Reply via email to