Powershell does not release the memory

Question:

When running this script from Powershell or Batch: find and replace characters in Windows XP (Powershell 1.0) all goes well. But after script has stopped processing a text file, Powershell still holds over 1 000 000 kb memory (when inspected from taskmanager) and it does not seem to release the memory usage. I’ll have to kill the Powershell process to free up the memory. How to prevent this huge memory usage?

Answer:

Try

That enforces garbage collection

Source:

Powershell does not release the memory by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply