lordmilko / PrtgAPI

C#/PowerShell interface for PRTG Network Monitor
MIT License
305 stars 38 forks source link

PRTG using lots of RAM when making use of powershell API and crashes #202

Closed BMNETWORK23 closed 3 years ago

BMNETWORK23 commented 3 years ago

Dear Developer,

I have a problem when using the PRTG API with Powershell. For certain actions is is going to eat RAM and I cannot get it down in any way I have tried. Finally the machine will eat all the RAM en become unusable. I could be due to my poor programming/scripting skills, but I wanted to reach out to you for ideas on how this happens or what I can do about it.

For example (not made up) the script below will eat up the RAM.

foreach($sensor in $allsnmptrafficsensors) { Write-Host $sensor.device Get-Sensor -id $sensor.id | Set-ObjectProperty -RawParameters @{monitorstate_ = 1} -Force }

The array $allsnmptrafficsensors contains a couple of hundred (500/600) when I ran the script. After this script is going all the way up to 12GB of RAM. When the script is finished it will not reduce the consumed RAM. Finally the machine becomes unusable.

What I have tried and seen:

Do I need to clear or explicitly kill the "API Call"?

Due Dilligance Please enter an 'x' between the brackets to indicate you have done these

lordmilko commented 3 years ago

Hi @BMNETWORK23,

Please see #198 for my analysis of this issue. In short, this is an issue with PRTG and is not something PrtgAPI can control. If the memory does not go down eventually, this indicates that the behavior you are seeing is in fact a memory leak, and so is even more definitely a bug in PRTG

Regards, lordmilko