added memprof option to observe memory consumption