fazalmajid / pingwatch

Simple monitoring tool for your Internet connection, pings hosts and reports on availability and trends
BSD 2-Clause "Simplified" License
29 stars 4 forks source link

Long term memory use #15

Open aslmx opened 3 years ago

aslmx commented 3 years ago

Hi,

i have pingwatch running for several weeks on a Raspi4 at home as well as on a VPS onthe internet. Today i received an email from the VPS monitoring tool that warned me about high memory usage. I didn't suspect pingwatch right away because there are plenty of other applications running on the VPS. However pingwatch had - if i read htop output correctly - something over 900MB of memory allocated. And approximately this amount was gone from the memory gauge when i quit pingwatch. Similar on the Raspi (while not so critical because it has 4GB of memory and it basically just runs a DNS server at the moment), pingwatch had something about 500-600MB allocated.

This took several weeks (4 or 5 maybe?) now.

I can think of quite easy workarounds like restarting pingwatch every night (I wanted to find out how to write systemd service units for it anyway), but maybe there is something in the go code that could be optimized to not have this happen?

Thanks

fazalmajid commented 3 years ago

Thanks for reporting the memory leak, I'll see what I can find out.

fazalmajid commented 3 years ago

OK, I found a pretty dumb memory leak, not sure if it's the only one.

aslmx commented 3 years ago

Cool Thanks! I'll keep an eye on it and report back if it leaks again.

aslmx commented 3 years ago

It did not "escalate" yet, however, memory usage rose significantly from starting the application (~12MB) and having it running for 2 weeks (~180MB).

I'll keep monitoring ;)

memlog.log