I need a shell script which will retrieve the maximum memory consumption of a linux executable. The executable may spawn child processes using significant amounts of RAM which should be included in the total.
I've tried /usr/bin/time -f "%M" /path/to/executable, but this always yields 0 though using ps I can verify the process is indeed consuming significant RAM.
Why is time giving me 0 all the time, and how can I get the number I'm looking for?