Wes - thanks for responding with a patch. Unfortunately, it didn't work.
I limited my perl script to the following but the memory issue still persists...
sub my_receiver {
print "PDU INFO:\n";
foreach my $k(keys(%{$_[0]})) {
my $key = sprintf("%s", $k);
printf " %-30s %s\n", $k, $_[0]{$k};
}
# print the variable bindings:
print "VARBINDS:\n";
foreach my $x (@{$_[1]}) {
printf "%d: %-30s type=%-2d value=%s\n",$index, $x->[0],
$x->[2], $x->[1];
}
print "---------------------\n\n\n";
}
NetSNMP::TrapReceiver::register("all", \&my_receiver) ||
warn "failed to register our perl trap handler\n";
print STDERR "Loaded the perl snmptrapd handler\n";
Thanks
Andy
-----Original Message-----
From: Wes Hardaker [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 20, 2005 8:08 PM
To: Andy Ford
Cc: Wes Hardaker; [EMAIL PROTECTED]; Net-Snmp (E-mail)
Subject: Re: Are there any examples of SNMP::TrapSession - I'll be
darnedIf I can get it to work!
>>>>> On Wed, 20 Apr 2005 10:03:10 +0100, "Andy Ford" <[EMAIL PROTECTED]> said:
Andy> I have taken a look at the embedded Perl approach and written a
Andy> script to do exactly what I want. Unfortunately, there is a huge
Andy> memory leak in the Perl side. I have already spoken to Robert
Andy> Story ref this problem and we have agreed it is the embedded
Andy> Perl implementation rather than snmptrapd itself.
Can you apply the following patch in the perl/TrapReceiver directory
and see if it fixes your embedded perl leak problem?
Index: TrapReceiver.xs
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/perl/TrapReceiver/TrapReceiver.xs,v
retrieving revision 1.4
diff -u -r1.4 TrapReceiver.xs
--- TrapReceiver.xs 8 Mar 2004 20:41:55 -0000 1.4
+++ TrapReceiver.xs 20 Apr 2005 19:07:03 -0000
@@ -134,6 +134,7 @@
av_push(vba,tmparray[i]);
av_push(vba,sv_2mortal(newSVpv(outbuf, oo_len)));
+ free(outbuf);
av_push(vba,sv_2mortal(newSViv(vb->type)));
av_push(varbinds, newRV((SV*)vba));
}
--
Wes Hardaker
Sparta, Inc.
This e-mail is private and may be confidential and is for the intended
recipient only. If misdirected, please notify us by telephone and confirm that
it has been deleted from your system and any copies destroyed. If you are not
the intended recipient you are strictly prohibited from using, printing,
copying, distributing or disseminating this e-mail or any information contained
in it. We use reasonable endeavours to virus scan all e-mails leaving the
Company but no warranty is given that this e-mail and any attachments are virus
free. You should undertake your own virus checking. The right to monitor
e-mail communications through our network is reserved by us.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users