Hi,
 
Very Sorry for my late reply. I was assigned to other works and back to this 
problem now.
after freeing varbind, memory usage was not reduced.
 
we are sending traps only and traps are received properly in management system 
configured.(Verified thro' Advent Net Manager - Trap viewer)
I have cross verified with other implementations and i cant find any problem in 
our implementation.
 
Using gdb  , I have identified that out of 40 K 
1. 8K is increased in method - 
 
   agent/agent_trap.c - send_trap_to_sess(netsnmp_session * sess, netsnmp_pdu 
*template_pdu)
 
   we are using net-snmp version 5.3.0.1 and line 881 /* snmp_free_pdu(pdu); */ 
is commented.
   In net-snmp version 5.4 it is uncommented.
 
2. 32 K ( increasing by 8 K for every call,this method is called in for loop )  
is increased in method - 
   agent/helpers/table_dataset.c - netsnmp_set_row_column(netsnmp_table_row 
*row, unsigned int column,
                                                int type, const char *value, 
size_t value_len)
 
   I doubt whether memory allocated and pointed to by row is freed or not.
   
 
Code flow to netsnmp_set_row_column 
==============================
#0  netsnmp_set_row_column (row=0x187a8b8, column=3, type=2, value=0xffbfeb74 
"", value_len=4)
    at table_dataset.c:1224
#1  0xff2c226c in log_notification (pdu=0x181dfa8, transport=0x3408)
    at notification-log-mib/notification_log.c:687
#2  0xff2bcc0c in send_notifications (major=2136456, minor=7, 
serverarg=0x2ffd08,
    clientarg=0xff304fe8) at notification/snmpNotifyTable.c:260
#3  0xff15ace0 in snmp_call_callbacks (major=1, minor=7, caller_arg=0x2ffd08) 
at callback.c:323
#4  0xff3688b0 in netsnmp_send_traps (trap=-1, specific=-1, 
enterprise=0xff392a64,
    enterprise_length=10, vars=0x2209320, context=0x0, flags=0) at 
agent_trap.c:783
#5  0xff3689d0 in send_enterprise_trap_vars (trap=-1, specific=-1, 
enterprise=0xff392a64,
    enterprise_length=10, vars=0x2209320) at agent_trap.c:797
#6  0xff29d0bc in send_eventTrap_trap () at ssg/ssg.c:1349 <------ Here we 
called send_v2trap
#7  0xff15d940 in run_alarms () at snmp_alarm.c:251     
 
 
Thanx,
Devi.U

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wed 3/14/2007 12:08 PM
To: Devi U; net-snmp-coders@lists.sourceforge.net
Subject: RE: how to purify net-snmp code




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


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




============================================================================================================================

Tech Mahindra, formerly Mahindra-British Telecom.
 
Disclaimer:

This message and the information contained herein is proprietary and 
confidential and subject to the Tech Mahindra policy statement, you may review 
at <a 
href="http://www.techmahindra.com/Disclaimer.html";>http://www.techmahindra.com/Disclaimer.html</a>
 externally and <a 
href="http://tim.techmahindra.com/Disclaimer.html";>http://tim.techmahindra.com/Disclaimer.html</a>
 internally within Tech Mahindra.

============================================================================================================================
-------------------------------------------------------------------------
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

Reply via email to