I develop a C code on Debian. I am looking for a program to monitor memory consumption of my code in real-time. The only value I care is the maximum RAM consumption, it should hold the value even if the the program is killed (e.g. by SIGKILL) . Could anyone suggest a handy tool for it?Normally I use top -p pidnumber, but it outputs with too much delay and if my program gets killed, it does not show the RAM consumption just before it is ended. 
a handy tool to measure memory consumption of a program
linux;process;memory
You can use the Valrind tool Massif.valgrind --tool=massif progOn default it creates a graph of the used heap memory, but it can also show the used stack memory withvalgrind --tool=massif --stacks=yes progValgrind has the tendency to slow down the execution of your program, so be warned if your application runs a long time. For more information about Massif I can recommend the Valgrind documentation which is quite good.