Devi, After freeing varbind, usage should decrease; PDU is already freed in netsnmp_send_traps() itself ( invoked by send_v2trap). Sending trap or inform? Are you receiving the traps in trapd? Cross check the API usage in other implementations (grep send_v2trap `find . -name "*.c"`)
We used method similar to apps/snmptrap.c and there is no memory usage raised / leaks. Pls refer snmptrap.c file for session creation & deletion. - Santhosh ________________________________________ From: Devi U [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 13, 2007 7:30 PM To: SANTHOSH S (WT01 - Broadband Networks); net-snmp-coders@lists.sourceforge.net Subject: RE: how to purify net-snmp code Santhosh, Thanx for ur immediate response. followed the same example - /examples/notification.c snmp_free_varbind is called in our code after send_v2trap(). In top output, i can see the size remains same even after snmp_free_varbind() is called.should size decrease after free is called? For every 100 msec, callback will be called,snmp_varlist_add_variable() is used to store the variables and send_v2trap() is called for sending a single trap. I dont know how to create session / send all traps in a single session. Thanx, Devi.U ________________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tue 3/13/2007 7:03 PM To: Devi U; net-snmp-coders@lists.sourceforge.net Subject: RE: how to purify net-snmp code Hi Devi, The increase shown in top is memory usage by the application; all increased bytes might have not been leaked. You need to free the varbinds after sending each trap/inform. snmp_free_varbind(notification_vars); refer: http://www.net-snmp.org/dev/agent/notification_8c-example.html Print the "top" output after freeing varbind and check the usage. Are you using single session to send all trap/inform or creating session before sending each inform/trap? - Santhosh ________________________________________ From: Devi U [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 13, 2007 6:44 PM To: net-snmp-coders@lists.sourceforge.net Cc: SANTHOSH S (WT01 - Broadband Networks) Subject: RE: how to purify net-snmp code Hi, thanx santhosh.. I am able to purify the code.. I feel that memory leak is there when send_v2trap is called, but i am not getting any MLK/PLK in traces top display: 26760 root 1 0 19 9248K 5608K run 0:01 0.30% snmpd top display after a trap is sent ===> for each trap sent there is a increase of 40K in SIZE and goes upto 50M. 26760 root 1 0 19 9288K 5648K run 0:01 0.31% snmpd we are using net-snmp version 5.3.0.1. whether above increase in SIZE is memory leak? Thanx, Devi.U The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders