This is a multi-part message in MIME format.

--===============1380764637==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C772B1.28C2EAB2"

This is a multi-part message in MIME format.

------_=_NextPart_001_01C772B1.28C2EAB2
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


=20
=20
Hi,
=20
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.
=20
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.
=20
Using gdb , I have identified that out of 40 K=20
1. 8K is increased in method -=20
=20
agent/agent_trap.c - send_trap_to_sess(netsnmp_session * sess,=
netsnmp_pdu *template_pdu)
=20
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.
=20
2. 32 K ( increasing by 8 K for every call,this method is called in for=
loop ) is increased in method -=20
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)
=20
I doubt whether memory allocated and pointed to by row is freed or not.
=20
=20
Code flow to netsnmp_set_row_column=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
#0 netsnmp_set_row_column (row=3D0x187a8b8, column=3D3, type=3D2, value=
=3D0xffbfeb74 "", value_len=3D4)
at table_dataset.c:1224
#1 0xff2c226c in log_notification (pdu=3D0x181dfa8, transport=3D0x3408)
at notification-log-mib/notification_log.c:687
#2 0xff2bcc0c in send_notifications (major=3D2136456, minor=3D7, serverarg=
=3D0x2ffd08,
clientarg=3D0xff304fe8) at notification/snmpNotifyTable.c:260
#3 0xff15ace0 in snmp_call_callbacks (major=3D1, minor=3D7, caller_arg=
=3D0x2ffd08) at callback.c:323
#4 0xff3688b0 in netsnmp_send_traps (trap=3D-1, specific=3D-1, enterprise=
=3D0xff392a64,
enterprise_length=3D10, vars=3D0x2209320, context=3D0x0, flags=3D0) at=
agent_trap.c:783
#5 0xff3689d0 in send_enterprise_trap_vars (trap=3D-1, specific=3D-1,=
enterprise=3D0xff392a64,
enterprise_length=3D10, vars=3D0x2209320) 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 =20
=20
=20
Thanx,
Devi.U

________________________________

From: santhosh.sundarasamy@wipro.com=
[mailto:santhosh.sundarasamy@wipro.com]
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:udevi@TechMahindra.com]
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

=20
Santhosh,
=20
Thanx for ur immediate response.
followed the same example - /examples/notification.c
=20
snmp_free_varbind is called in our code after send_v2trap().
=20
In top output, i can see the size remains same even after=
snmp_free_varbind() is called.should size decrease after free is called?
=20
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.
=20
I dont know how to create session / send all traps in a single session.
=20
Thanx,
Devi.U
________________________________________
From: santhosh.sundarasamy@wipro.com=
[mailto:santhosh.sundarasamy@wipro.com]
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/no...c-example.html =20

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:udevi@TechMahindra.com]
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,
=20
thanx santhosh..
I am able to purify the code..
=20
I feel that memory leak is there when send_v2trap is called, but i am not=
getting any MLK/PLK in traces
=20
top display:
=20
26760 root 1 0 19 9248K 5608K run 0:01 0.30% snmpd
=20
top display after a trap is sent =3D=3D=3D> 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
=20
we are using net-snmp version 5.3.0.1.
=20
whether above increase in SIZE is memory leak?
=20
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




=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D

Tech Mahindra, formerly Mahindra-British Telecom.
=20
Disclaimer:

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

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D
------_=_NextPart_001_01C772B1.28C2EAB2
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

=3Diso-8859-1">





RE: how to purify net-snmp code



=3D2> 


 

Hi,

 

Very Sorry for my late reply. I was=
assigned to=20
other works and back to this problem now.

after freeing varbind, memory usage was=
not=20
reduced.

 

we are sending traps only and traps are=
received=20
properly in management system configured.(Verified thro' Advent Net Manager=
=20
- Trap viewer)

I have cross verified with other=
implementations=20
and i cant find any problem in our implementation.

 

Using gdb  , I have identified that=
out of 40=20
K

1. 8K is increased in method -=

 

   agent/agent_trap.c -=20
send_trap_to_sess(netsnmp_session * sess, netsnmp_pdu=20
*template_pdu)

 

   we are using net-snmp version=
5.3.0.1=20
and line 881 /* snmp_free_pdu(pdu); */ is commented.

   In net-snmp version 5.4 it is=
=20
uncommented.

 

2. 32 K ( increasing by 8 K for every=
call,this=20
method is called in for loop )  is increased in method -

   agent/helpers/ =3DArial=20
size=3D2>table_dataset.c -
netsnmp_set_row_column(netsnmp_table_row=
*row,=20
unsigned int=20
column,
          &nbs=
p;            &=
nbsp;=20
            &nb=
sp;         =20
int type, const char *value, size_t value_len)

 

   I doubt whether memory=20
allocated and pointed to by row is freed or not.

  

 

Code flow to netsnmp_set_row_column=20

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

#0  netsnmp_set_row_column (row=
=3D0x187a8b8,=20
column=3D3, type=3D2, value=3D0xffbfeb74 "", value_len=
=3D4)
    at=20
table_dataset.c:1224
#1  0xff2c226c in log_notification (pdu=
=3D0x181dfa8,=20
transport=3D0x3408)
    at=20
notification-log-mib/notification_log.c:687
#2  0xff2bcc0c in=20
send_notifications (major=3D2136456, minor=3D7,=20
serverarg=3D0x2ffd08,
    clientarg=3D0xff304fe8) at=20
notification/snmpNotifyTable.c:260
#3  0xff15ace0 in=
snmp_call_callbacks=20
(major=3D1, minor=3D7, caller_arg=3D0x2ffd08) at callback.c:323
#4 =
0xff3688b0=20
in netsnmp_send_traps (trap=3D-1, specific=3D-1,=20
enterprise=3D0xff392a64,
    enterprise_length=3D10,=20
vars=3D0x2209320, context=3D0x0, flags=3D0) at agent_trap.c:783
#5 =
0xff3689d0=20
in send_enterprise_trap_vars (trap=3D-1, specific=3D-1,=20
enterprise=3D0xff392a64,
    enterprise_length=3D10,=20
vars=3D0x2209320) at agent_trap.c:797
#6  0xff29d0bc in=20
send_eventTrap_trap () at ssg/ssg.c:1349 <------ Here we called=20
send_v2trap
#7  0xff15d940 in run_alarms () at=20
snmp_alarm.c:251    

 

 

Thanx,

Devi.U




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




Devi,
        After=
=20
freeing varbind, usage should decrease; PDU is already freed in=20
netsnmp_send_traps() itself ( invoked by send_v2trap). Sending trap or=
inform?=20
Are you receiving the traps in trapd?  Cross check the API usage in=
other=20
implementations (grep send_v2trap `find . -name=20
"*.c"`)

        We used method=
similar=20
to apps/snmptrap.c and there is no memory usage raised / leaks. Pls refer=20
snmptrap.c file for session creation &=20
deletion.

-
Santhosh

_____________________________________=
___
From:=20
Devi U [ href=
=3D"mailto:udevi@TechMahindra.com">mailto:udevi@TechMahindra.com]
Se=
nt:=20
Tuesday, March 13, 2007 7:30 PM
To: SANTHOSH S (WT01 - Broadband=
Networks);=20
net-snmp-coders@lists.sourceforge.net
Subject: RE: how to purify=
net-snmp=20
code

 
Santhosh,
 
Thanx for ur immediate=20
response.
followed the same example -=20
/examples/notification.c
 
snmp_free_varbind is called in our=20
code after send_v2trap().
 
In top output, i can see the=
size=20
remains same even after snmp_free_varbind() is called.should size decrease=
after=20
free is called?
 
For every 100 msec, callback will be=20
called,snmp_varlist_add_variable() is used to store the=
variables and=20
send_v2trap() is called for sending a single trap.
 
I dont know=
how=20
to create session / send all traps in a single=20
session.
 
Thanx,
Devi.U
_________________________________=
_______
From:=20
santhosh.sundarasamy@wipro.com [ href=
=3D"mailto:santhosh.sundarasamy@wipro.com">mailto:santhosh.sundarasamy@wipr=
o.com]
Sent:=20
Tue 3/13/2007 7:03 PM
To: Devi U;=20
net-snmp-coders@lists.sourceforge.net
Subject: RE: how to purify=
net-snmp=20
code

Hi Devi,
        The=
increase=20
shown in top is memory usage by the application; all increased bytes might=
have=20
not been leaked.

        You need=
to=20
free the varbinds after sending each=20
trap/inform.
       =20
       =20
snmp_free_varbind(notification_vars);
     &nbs=
p; =20
refer: href=
=3D"http://www.net-snmp.org/dev/agent/notification_8c-example.html">http://=
www.net-snmp.org/dev/agent/notification_8c-example.html=20
 

        Print the "top"=
output=20
after freeing varbind and check the=20
usage.

        Are you using=
single=20
session to send all trap/inform or creating session before sending each=20
inform/trap?

-
Santhosh
______________________________________=
__
From:=20
Devi U [ href=
=3D"mailto:udevi@TechMahindra.com">mailto:udevi@TechMahindra.com]
Se=
nt:=20
Tuesday, March 13, 2007 6:44 PM
To:=20
net-snmp-coders@lists.sourceforge.net
Cc: SANTHOSH S (WT01 - Broadband=20
Networks)
Subject: RE: how to purify net-snmp=20
code

Hi,
 
thanx santhosh..
I am able to purify the=20
code..
 
I feel that memory leak is there when send_v2trap=
is=20
called, but i am not getting any MLK/PLK  in=
traces
 
top=20
display:
 
26760 root      =20
1   0   19 9248K 5608K run    =20
0:01  0.30% snmpd
 
top display after a trap is sent =3D=3D=
=3D> for=20
each  trap sent there is a increase of 40K in SIZE and goes upto=20
50M.
26760 root       1  =20
0   19 9288K 5648K run     0:01  0.31%=20
snmpd
 
we are using net-snmp version=
5.3.0.1.
 
whether=20
above increase in SIZE is memory=20
leak?
 
Thanx,
Devi.U


The information contained in=
this=20
electronic message and any attachments to this message are intended for the=
=20
exclusive use of the addressee(s) and may contain proprietary, confidential=
or=20
privileged information. If you are not the intended recipient, you should=
not=20
disseminate, distribute or copy this e-mail. Please notify the sender=20
immediately and destroy all copies of this message and any=20
attachments.

WARNING: Computer viruses can be transmitted via email.=
The=20
recipient should check this email and any attachments for the presence of=20
viruses. The company accepts no liability for any damage caused by any=
virus=20
transmitted by this email.

www.wipro.com


The information=
=20
contained in this electronic message and any attachments to this message=
are=20
intended for the exclusive use of the addressee(s) and may contain=
proprietary,=20
confidential or privileged information. If you are not the intended=
recipient,=20
you should not disseminate, distribute or copy this e-mail. Please notify=
the=20
sender immediately and destroy all copies of this message and any=20
attachments.

WARNING: Computer viruses can be transmitted via email.=
The=20
recipient should check this email and any attachments for the presence of=20
viruses. The company accepts no liability for any damage caused by any=
virus=20
transmitted by this=20
email.

www.wipro.com





=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D



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 =3D"http://www.techmahindra.com/Disclaimer.html">http://www.techmahindra.co=
m/Disclaimer.html externally and =3D"http://tim.techmahindra.com/Disclaimer.html">http://tim.techmahindra.co=
m/Disclaimer.html internally within Tech Mahindra.



=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=
=3D


------_=_NextPart_001_01C772B1.28C2EAB2--



--===============1380764637==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
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?p...rge&CID=DEVDEV
--===============1380764637==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/...et-snmp-coders

--===============1380764637==--