Ask HN: profiling memory - what should we use
What are you using to test memory leaks?
Any help would be much appreciated.
What are you using to test memory leaks?
Any help would be much appreciated.
I'm not suggesting that this is a good approach or that anyone else should use it, but... I run with ktrace and with MALLOC_OPTIONS=U set in the environment. This logs every single call to malloc(), realloc(), and free(); I then throw the log files at a perl script which matches up allocations with frees and gives me a list of every time memory was allocated without being subsequently freed.
Of course, this is only feasible because I'm working in C; and I'm sure there are better tools available if I could be bothered to learn how to use them.
http://guppy-pe.sourceforge.net/#Heapy
for a Python heap profiler. As for C, my weapon of choice is Valgrind. It sandboxes the application and can also do some simple cache profiling etc. It is pretty easy to run as well as there are no need to link any special memory allocator into your program.