Message356596
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() |
|
Date |
User |
Action |
Args |
2019-11-14 11:17:35 | vstinner | set | recipients:
+ vstinner, benjamin.peterson, asvetlov, yselivanov, aeros |
2019-11-14 11:17:35 | vstinner | set | messageid: <1573730255.7.0.659244975111.issue38591@roundup.psfhosted.org> |
2019-11-14 11:17:35 | vstinner | link | issue38591 messages |
2019-11-14 11:17:35 | vstinner | create | |
|