pythonprofilers / memory_profiler

Monitor Memory usage of Python code
http://pypi.python.org/pypi/memory_profiler
Other
4.39k stars 380 forks source link

multiprocessing_example.py fails when using -C flag #260

Open kspieks opened 5 years ago

kspieks commented 5 years ago

Thanks for providing the examples! I'm able to reproduce the multiprocessing example as shown below when using mprof run --multiprocess multiprocessing_example.py

multiprocessing_example_-M

I can also produce this plot to see the total memory consumption by using mprof run --multiprocess --include-children multiprocessing_example.py

multiprocessing_example_-C_-M

However, mprof run --include-children multiprocessing_example.py fails with the final error message as _pickle.PicklingError: Can't pickle <function worker at 0x7f9980295510>: attribute lookup worker on __main__ failed. Can you help me understand why using only the -C flag causes the run to fail, but using both -C and -M successfully runs.