python - Why does concurrent.futures increase vms memory? -


i find when use python's concurrent.futures.threadpoolexecutor vms memory use (as reported psutil) increases dramatically.

in [1]: import psutil  in [2]: psutil.process().memory_info().vms / 1e6 out[2]: 360.636416  in [3]: concurrent.futures import threadpoolexecutor  in [4]: e = threadpoolexecutor(20)  in [5]: psutil.process().memory_info().vms / 1e6 out[5]: 363.15136  in [6]: futures = e.map(lambda x: x + 1, range(100))  in [7]: psutil.process().memory_info().vms / 1e6 out[7]: 1873.580032  in [8]: e.shutdown()  in [9]: psutil.process().memory_info().vms / 1e6 out[9]: 1722.51136 

this seems proportional number of threads.

you might running (assuming on linux):

https://siddhesh.in/posts/malloc-per-thread-arenas-in-glibc.html

this can bloat virtual memory size when rss not increasing much.

(incidentally, vms can misleading in other situations, such cuda, driver expands virtual memory space of process in order create unified address space of cuda devices in system.)


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -