Check the man page for a while. You can specify a format string where you can display memory information. For example:
> time -f "mem:% M" some_random_command
mem: NNNN
displays the maximum resident set size for a process during its lifetime, in Kilobytes.
source
share