Mauro Cazabonnet
asked on
Powershell continous loop memory consumption
Hi I'm running a continuous loop, and running into a memory issue
$date=(get-date).day
while($date -eq ((get-date).day))
{
Start-Sleep -Seconds 10
}
memory consumption of powershell.exe increases over time is there a way to keep it in check for this simple loop?
$date=(get-date).day
while($date -eq ((get-date).day))
{
Start-Sleep -Seconds 10
}
memory consumption of powershell.exe increases over time is there a way to keep it in check for this simple loop?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Awesome thx!...
ASKER
Thx...
Does that really help?
ASKER
i ran this simple loop and the [GC.System]::Collect does prevent the powershell.exe thread from increasing in memory. (You can test yourself)
I have it running every 15 minutes on my current service
I do have a complex process running based on user demand, and the working memory on the iis server is not increasing in size
I have it running every 15 minutes on my current service
I do have a complex process running based on user demand, and the working memory on the iis server is not increasing in size
If all you do the loop for is to wait, then you should just run a single sleep with the correct number of seconds.