[ACCEPTED]-Powershell does not release the memory-memory-management

Accepted answer
Score: 10

Try

 [GC]::Collect()

That enforces garbage collection

0

Score: 1

It seems that there is a memory leak in 3 Get-Content.

[GC]::Collect didn't work in 2 our case when loading ~6000 documents and 1 we had to use a StreamReader instead:

$sr = New-Object System.IO.StreamReader($filepath)

...

$sr.Dispose()

More Related questions