Hi Dave,

Thanks for your help.

I have tried to add a shutdown_xxx function in my dynamic module, but
it seems not be called when I use "killall -HUP snmpd" to reload config 
file.

My snmp agent version is 5.1.1.
Is there any step I miss?


Thanks,



永鈦鑫   iTAS Corporation
新竹市水源街75號
NO. 75,Shuiyuan St., Hsinchu City, Taiwan, R.O.C.
Tel:03-5716099 Ext.1208
E-mail:[email protected]
----- Original Message ----- 
From: "Dave Shield" <[email protected]>
To: "Tewen Hsieh" <[email protected]>
Cc: <[email protected]>
Sent: Tuesday, June 02, 2009 3:42 PM
Subject: Re: Does "killall -HUP snmpd" unload dynamic module?


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