File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ mod macos_memory {
5858
5959 const RUSAGE_INFO_V2 : libc:: c_int = 2 ;
6060
61+ #[ link( name = "proc" , kind = "dylib" ) ]
6162 extern "C" {
6263 fn proc_pid_rusage (
6364 pid : libc:: c_int ,
@@ -336,7 +337,7 @@ pub fn start_global_resource_monitor(
336337 tree_pids
337338 ) ;
338339
339- // Refresh only the processes we need for memory info
340+ // Processes needing to be refreshed
340341 let pids_to_refresh: Vec <Pid > =
341342 tree_pids. iter( ) . map( |& p| Pid :: from_u32( p) ) . collect( ) ;
342343
@@ -486,8 +487,10 @@ fn collect_memory_and_threads(
486487 // undercount by 10x or more on idle processes.
487488 #[ cfg( target_os = "macos" ) ]
488489 {
489- total_memory += macos_memory:: get_phys_footprint ( pid) . unwrap_or ( 0 ) ;
490- total_threads += 1 ;
490+ if let Some ( footprint) = macos_memory:: get_phys_footprint ( pid) {
491+ total_memory += footprint;
492+ total_threads += 1 ;
493+ }
491494 }
492495
493496 #[ cfg( not( target_os = "macos" ) ) ]
You can’t perform that action at this time.
0 commit comments