peak_memory#

mufasa.utils.memory.peak_memory(output_container=None)[source]#

Decorator to monitor and display the peak memory usage of a function, including intermediate peaks, and handle multi-threaded tasks.

Args:
output_container (list or dict, optional): A mutable object where the

peak memory usage will be stored. If None, it defaults to printing the peak memory usage.

Returns:

function: A wrapped function that reports peak memory usage.