time is a brilliant command if you want to figure out how much CPU time a given command takes.
I am looking for something similar that can measure the max RAM usage of the program and any children. Preferably it should distinguish between allocated memory that was used and unused. Maybe it could even give the median memory usage (so the memory usage you should expect when running for a long time).
So I would like to do:
rammeassure my_program my_args
and get output similar to:
Max memory allocated: 10233303 Bytes Max memory used: 7233303 Bytes Median memory allocation: 5233303 Bytes
I have looked at
memusg https://gist.github.com/526585/590293d6527c91e48fcb08edb8de9fd6c88a6d82 but I regard that as somewhat a hack.