File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -511,14 +511,17 @@ def process_monitor(self, sproc: "subprocess.Popen[str]") -> None:
511511 memory_usage : MutableSequence [Optional [int ]] = [None ]
512512
513513 def get_tree_mem_usage (memory_usage : MutableSequence [Optional [int ]]) -> None :
514- children = monitor .children ()
515514 try :
516- rss = monitor .memory_info ().rss
517- while len (children ):
518- rss += sum (process .memory_info ().rss for process in children )
519- children = list (itertools .chain (* (process .children () for process in children )))
520- if memory_usage [0 ] is None or rss > memory_usage [0 ]:
521- memory_usage [0 ] = rss
515+ with monitor .oneshot ():
516+ children = monitor .children ()
517+ rss = monitor .memory_info ().rss
518+ while len (children ):
519+ rss += sum (process .memory_info ().rss for process in children )
520+ children = list (
521+ itertools .chain (* (process .children () for process in children ))
522+ )
523+ if memory_usage [0 ] is None or rss > memory_usage [0 ]:
524+ memory_usage [0 ] = rss
522525 except psutil .NoSuchProcess :
523526 mem_tm .cancel ()
524527
You can’t perform that action at this time.
0 commit comments