2009/6/2 Tewen Hsieh <[email protected]>:
> If there is malloc( ) in my dynamic module, does it cause any memory leak
> problem when I use "killall -HUP snmpd" to reload config file?

That depends on your code.

> Is the dynamic allocated memory freed by OS automatically?

Only when the agent exits - not when it simply receives a signal.


> Or I should free it by myself?

When the agent re-loads the config file, it will call the 'shutdown_xxx'
routine for each module (assuming that the module defines one).
This is where you should release any dynmically allocated resources.

Essentially, 'shutdown_xxx' should undo anything that was set up in
the 'init_xxx' or config parsing routines.

Dave

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to