I have about 100 powershell scripts running on a server and after 9 days without a restart, the memory usage by powershell jumps to 99% of the machine. This occurs regularly. I'm looking for a way to identify which script is the culprit to verify that all of the objects are disposed and cleared correctly.
1 Answer
Have a look at this script.
You can use remove-variable VarName (not $VarName) and [System.GC]::collect() to run the Garbagecollector manually. I often use it for freeing space of big hashtables/Array after foreach loops with it.