STINNER Victor <[email protected]> added the comment:
I measured the RSS memory per thread: it's around 13.2 kB/thread. Oh, that's
way lower than what I expected.
Script:
# 10: 9636 kB => 9756 kB: +12 kB/thread
# 100: 9476 kB = 10796 kB: +13.2 kB/thread
# 1000: 9552 kB = 22776 kB: +13.2 kB/thread
import os
import threading
def display_rss():
os.system(f"grep ^VmRSS /proc/{os.getpid()}/status")
def wait(event):
event.wait()
class Thread(threading.Thread):
def __init__(self):
super().__init__()
self.stop_event = threading.Event()
self.started_event = threading.Event()
def run(self):
self.started_event.set()
self.stop_event.wait()
def stop(self):
self.stop_event.set()
self.join()
def main():
nthread = 1000
display_rss()
threads = [Thread() for i in range(nthread)]
for thread in threads:
thread.start()
for thread in threads:
thread.started_event.wait()
display_rss()
for thread in threads:
thread.stop()
main()
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38591>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com