Advertisement
guyrleech

Display percentage of committed memory in use, updating every minute

Oct 13th, 2021 (edited)
789
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## display percentage of committed memory in use, updating every minute - when this approaches 100% , bad things start to happen like process crashes due to lack of memory
  2. ## written after experiencing committed memory exhaustion caused by apparent section handle leak in wudfhost.exe for DisplayLink drivers yet process memory & commit of that process is not excessive
  3.  
  4. while(1) { $commitPercent = Get-CimInstance Win32_OperatingSystem|select @{n='Commit %';e={  [math]::Round( ( $_.TotalVirtualMemorySize - $_.FreeVirtualMemory ) / $_.TotalVirtualMemorySize * 100 , 1 ) }}|select -ExpandProperty 'Commit %'; $mostHandles = Get-Process|Sort HandleCount -Descending|select -first 1; Write-Output "$(Get-Date -Format G) : Commit $commitPercent% ; Process $($mostHandles.Name) has $($mostHandles.HandleCount) handles" ; start-sleep 60 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement