digitalmars.D.learn - Memory profiling D applications
- Griffon26 (22/22) Jan 31 I would like to get a view of the amount of memory that my
I would like to get a view of the amount of memory that my application requires over time, but this does not seem to be trivial in D. 1) I assume the garbage collector could keep around memory that my application is no longer using. If this is the case then no external memory profiler is going to give me the information I'm looking for and I have to ask the garbage collector how much is in use by my application. However, I have not found any interfaces that allow me to request this information. Is it even possible? 2) Not everything uses garbage-collected memory. std.container.array uses regular malloc/free calls. To include these in the result I would still have to use an external profiler to track mallocs (valgrind's massif or heaptrack for example) and ignore the calls coming from the GC. I've also tried running my application in a cgroup and limit the available memory to determine peak memory usage experimentally, but I'd much rather have a graph of usage over time. Has anyone done anything like this before? Are there better ways to do this? Thanks, Maurice.