Hi all:

I'm debugging my own AgentX subagent on Windows XP under Visual Studio 2005, 
and, I always get a number of memory leaks reported on shutdown.

I normally develop with memory leak detection turned on, so that I quickly find 
out about any new leaks I might have just introduced in the code. This strategy 
does not work for Net-SNMP, and it looks like it's by design, this is what I 
found on your Web site:

  http://www.net-snmp.org/wiki/index.php/Debugger
  Section "Valgrind / Memory Leaks"

------8<------8<------8<------8<------8<------
Note, however, that Net-SNMP relies on the operating system to cleanup
memory when an application exits, so there will be lots of un-released
memory when the application exits. Please don't report this as a bug.
We are only interested in memory leaks that grow over time. 
...
Note that since some memory leaks may be reported anyway just from
initialization allocations that were never cleaned up, the best way to
check for memory leaks in your mib-module code is to run valgrind
twice. In the first run, perform a single snmpget or snmpwalk on your MIB 
implemenatation. The next time, perform 1000 of the same
task. Then compare the two runs and if the memory usage is different
for some section of code (by a factor of 1000) then you've definitely
found a leak.
------8<------8<------8<------8<------8<------

I find the the suggested leak-debugging procedure cumbersome and error-prone. 
It would be nice if all malloc'ed memory were free'd on shutdown. I guess that 
would be inside snmp_shutdown(), or maybe I'm just missing some clean-up call 
somewhere.

Many thanks,
  Ruben


      

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to