But if you'd posted the code 3 days ago as asked, your problem would probably be fixed by now.
Oh? :P The problem with that is that the code is over 100K and there's really nothing wrong with my code, I mean I've been staring at it for weeks and I have been doing this for many years.

I think I've found something with my rebuild effort. A code block that when commented out, the script doesn't leak. I really defy anyone to find anything syntacticly wrong with this code. :)

## all in ifpoll local %routes = (); my $result6; ## device can have CIDR or non-CIDR routing $result6 = $$session->get_entries(-columns => [$ipCidrRouteIfIndex, $i +pCidrRouteProto, $ipCidrRouteType ]); $result6 = $$session->get_entries(-columns => [$ipRouteNextHop, $ipRou +teIfIndex, $ipRouteMask, $ipRouteProto, $ipRouteType]) unless %$resul +t6; if (!defined($result6)) { printf(STDERR "ERROR(routes): %s %s.\n", $devarg, $$session->err +or); } local $testkey = each %$result6; if ($testkey =~ m/^\Q1.3.6.1.2.1.4.24.4.1.\E/o) { print "Entering CIDR parsing\n"; foreach $key (keys %$result6) { if ($key =~ m/^\Q$ipCidrRouteProto\E/o) { my @temp = $key =~ m/^\Q$ipCidrRouteProto\E\.(\d{1,3}\.\d{ +1,3}\.\d{1,3}\.\d{1,3})\.(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\.0\.(\d +{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/o; my $id = join ".", @temp; $routes{$id}{"proto"} = ${$result6}{$key}; } elsif ($key =~ m/^\Q$ipCidrRouteType\E/o) { my @temp = $key =~ m/^\Q$ipCidrRouteType\E\.(\d{1,3}\.\d{1 +,3}\.\d{1,3}\.\d{1,3})\.(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\.0\.(\d{ +1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/o; my $id = join ".", @temp; $routes{$id}{"type"} = ${$result6}{$key}; } elsif ($key =~ m/^\Q$ipCidrRouteIfIndex\E/o) { # dest +network dest mask + next hop my @temp = $key =~ m/^\Q$ipCidrRouteIfIndex\E\.(\d{1,3}\.\ +d{1,3}\.\d{1,3}\.\d{1,3})\.(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\.0\.( +\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/o; my $id = join ".", @temp; $routes{$id}{"net"} = $temp[0]; $routes{$id}{"mask"} = $temp[1]; $routes{$id}{"nexthop"} = $temp[2]; $routes{$id}{"ifindex"} = ${$result6}{$key}; } } } elsif ($testkey =~ m/^\Q1.3.6.1.2.1.4.21.1.\E/) { print "Entering non CIDR parsing\n"; foreach $key (keys %$result6) { my $index; if (($index) = $key =~ m/^\Q$ipRouteNextHop\E\.(.+)/o) { #print "Found next hop ${$result6}{$key} for $index in $ke +y\n"; $routes{$index}{"nexthop"} = ${$result6}{$key} ; #|| "NULL +" or die "route assignment failed\n"; $routes{$index}{"net"} = $index; } elsif (($index) = $key =~ m/^\Q$ipRouteIfIndex\E\.(.+)/o) { $routes{$index}{"ifindex"} = ${$result6}{$key}; # || "NULL +" or die "route assignment failed\n"; #print "Found destination ${$result6}{$key} for $index in +$key\n"; } elsif (($index) = $key =~ m/^\Q$ipRouteMask\E\.(.+)/o) { $routes{$index}{"mask"} = ${$result6}{$key}; # || "NULL" o +r die "route assignment failed\n"; #print "Found mask${$result6}{$key} for $index in $key\n"; } elsif (($index) = $key =~ m/^\Q$ipRouteProto\E\.(.+)/o) { $routes{$index}{"proto"} = ${$result6}{$key}; # || "NULL" +or die "route assignment failed\n"; #print "Found mask${$result6}{$key} for $index in $key\n"; } elsif (($index) = $key =~ m/^\Q$ipRouteType\E\.(.+)/o) { $routes{$index}{"type"} = ${$result6}{$key}; # || "NULL" o +r die "route assignment failed\n"; #print "Found mask${$result6}{$key} for $index in $key\n"; } } } %{$datahash{"routes"}} = %routes;
$session is a reference to the Net::SNMP object. $result6 is a reference to an anonymous hash containing the SNMP return values. Comment this all out and no memory leak.

Any ideas?


In reply to Re^2: Massive Perl Memory Leak by wagnerc
in thread Massive Perl Memory Leak by wagnerc

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.