fabianp/memory_profiler — pull request #51 by cheesinglee (2013-06-21 19:21:11+00:00)
Title: Add some options to memory_usage()

I found that I needed to modify the behavior of the profiler to suit my purposes. I've implemented these modifications as kwargs to memory_usage(), and I'm submitting this commit in hope that other people may find them useful.

The **max_usage** parameter modifies the behavior of the function so that it
only keeps track of the peak mem usage over the duration of the
profiling. This is useful for profiling very long running processes.

The **retval** parameter is for profiling Python functions. If set, the
return value of the profiled function will be kept and returned in a
tuple along with the memory usage.

By default, both these parameters are False.