This is a difficult problem, because there is no good,
cross platform method of determining exactly how much
memory is in use by a program.
Sample the memory file in /proc - the method used with
the original language shootout.
Use system call tracing on the 'brk' system call.