# Help with net-snmp memory leak



## roscoe (Apr 25, 2010)

I am currently running *net-snmp-5.4.2.1_6* with *cacti-0.8.7e4* for remote monitoring of my server.

Since upgrading to _FreeBSD 8.0-RELEASE_ I have noticed a memory leak issue with net-snmp.  Maybe it was there with 7.2-RELEASE, I am not sure.

I currently have Cacti set up with a 5 minute polling cycle where some SNMP MIBs are polled (i.e. ethernet traffic usage, CPU usage, etc.)

*Memory leak issue: *after each poll, *snmpd *uses up four additional kilobytes.  Each day, it consumes about one additional megabyte.  If I restart snmpd, memory usage goes back down to normal (about 5,000 kilobytes).

Any ideas on how to fix this?  I can also replicate this in a virtual machine running 8.0-RELEASEp2 (vmware workstation).

Thanks!


----------



## roscoe (Apr 25, 2010)

As a further update, the *snmpd *process running on its own (with no SNMP polling or Cacti running) seems to eat up memory anyways.


----------



## galaxsat (Dec 23, 2010)

I have been seeing as similar leak on FreeBSD 7.3 with net-snmp-5.5_4, only it's eating up /var rather than real memory. I'm also using cacti-0.8.7g, but as you say, it doesn't seem that Cacti is the issue.


```
# lsof -p <pid of snmpd>
...
snmpd   48564 root    3w  VREG       0,79 364942730  165266 /var (/dev/mirror/gm0s1d)
...
```

Restarting snmpd does the trick every time. Mine's been going on since at least July, when I first noticed it. I keep my ports up to date religiously.


----------



## SirDice (Dec 23, 2010)

The changelog mentions "Fix various memory leaks". You could file a PR to get net-snmp updated to version 5.6, hopefully those fixes will be included in that version.


----------



## galaxsat (Dec 24, 2010)

Thanks for pointing that out. I'm a bit embarrassed now, as I updated net-snmp last week, but you made me realize I hadn't restarted snmpd since, so 5.5 may very well have fixed my issue! I will follow up in a few days...


----------



## galaxsat (Dec 30, 2010)

Nope, still leaking...

```
# lsof -p <pid of snmpd>
...
snmpd   43652 root    3w  VREG       0,79 40909387  165333 /var (/dev/mirror/gm0s1d)
...
```


----------

