0

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
  • Some peer review of the script may point to something obvious as well. Perhaps you are loading XML into memory for example, and not cleaning it up? (ie. [xml]$xml = gc some/big/doc.xml) Commented Feb 18, 2016 at 13:55

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.