Current and Peak Memory consumption of my program?

Hi,

my C++ program does some memory consuming tasks and runs several minutes.
During execution time, I want to print information on the current memory consumption and peak memory consumption of my program into a logfile.
How can I retrieve this information, i.e. which functions are available to get memory and peak memory of my program?
I don't want to call any commands like "ps" etc. via system(), but would like to use functions supported by AIX and implement them in my C++ coding.

Thanks!