Skip to content

Commit

Permalink
from ActivitySim ActivitySim#625
Browse files Browse the repository at this point in the history
  • Loading branch information
dhensle committed Dec 6, 2022
1 parent 91898dd commit 68100ba
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions activitysim/core/mem.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,12 @@ def trace_memory_info(event, trace_ticks=0):
current_process = psutil.Process()

if USS:
info = current_process.memory_full_info()
uss = info.uss
try:
info = current_process.memory_full_info()
uss = info.uss
except (PermissionError, psutil.AccessDenied, RuntimeError):
info = current_process.memory_info()
uss = 0
else:
info = current_process.memory_info()
uss = 0
Expand Down Expand Up @@ -254,8 +258,12 @@ def get_rss(force_garbage_collect=False, uss=False):
gc.disable()

if uss:
info = psutil.Process().memory_full_info()
return info.rss, info.uss
try:
info = psutil.Process().memory_full_info()
return info.rss, info.uss
except (PermissionError, psutil.AccessDenied, RuntimeError):
info = psutil.Process().memory_info()
return info.rss, 0
else:
info = psutil.Process().memory_info()
return info.rss, 0
Expand Down

0 comments on commit 68100ba

Please sign in to comment.