[ECOS] SNMP memory leak

Laurie Gellatly laurie.gellatly@netic.com
Sun Mar 25 09:57:00 GMT 2012

Hi All,
If your device is running the SNMP agent I suggest you read this:

I've been made aware of a memory leak in the SNMP agent for eCos.
This thread http://sourceware.org/ml/ecos-discuss/2007-06/msg00241.html
talks about a leak as well but does not clearly show the resolution.

To find out if you have the issue do this:
1) If you have not already then devise a method to show mall.fordblks from
mall=mallinfo() and note the amount of free memory shown in the running
2) run this command against your device with a community string unknown to
your device: snmpget -c badpublic . ; replace with your device's IP
3) do mall=mallinfo() again and note the mall.fordblks afterwards and you
will see your free memory has reduced. Repeat these steps and it will
continue to reduce till it exhausts memory.
If you use the correct SNMP community string then memory is not leaked.

So I updated and modified snmp_agent.c & .h and snmp_api.c & .h from
ucd_snmp 4.2.7 (as implied in the thread above).
Although it fixed the leak, SNMP traps sent from the device are now broken.
(I'm still tracking it down but I'm guessing it's a memory issue as well).

Have you checked your own devices to see if you have this problem?
Has anyone made changes to the SNMP files and fixed both issues and are you
willing to share?

I'll happily post the new version I've tried if that will help - you just
can't drop the 4.2.7 files in to replace the old (that would be too easy).

Thanks              ...Laurie:{)

Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list