0

Using memory_profiler library to profile the script right now. Below is how it is recommended per the documentation. Need to decorate the function. Below is a dummy example on running python script.py it display the memory usage.

from memory_profiler import profile
@profile
def my_func():
    a = [1] * (10 ** 6)
    b = [2] * (2 * 10 ** 7)
    del b
    return a

if __name__ == '__main__':
    my_func()

Issue: My production script is alot more complex with several functions, I am decorating those. But, this approach doesn't seem user friendly to profile the usage at different places/functions etc. Any way to do it better?

Lata
  • 107
  • 5

0 Answers0