The %datahash hash only accumulates 50-150K depending on the device
and it's blown away at each iteration. The script saves very little
data persistently. I monitor those variables for size and they don't
grow out of control. Watching the script with top shows the memory
usage grow geometrically. Slow at first, then going up 1-5 meg every
few seconds. The memory usage
accelerates.
I have a previous version of the script that doesn't have the memory leak.
The only real difference is the use of a central datahash to keep
everything. The old script just directly prints everything. That's
why I think this is the culprit.
I wrote a test script that used Padwalker to check on the my'd variables
with peek_my and then Data::Dump that hash. That showed something
very interesting. After I assigned the independent hashes into the datahash
(%{$datahash{"branch"}} = %branchdata;) the dump showed both hashes were
refering to the same data. It wasn't a pure copy. Like:
do {
my $a = {
"%cdp" => {
"1.4" => {
id => "switch",
ip => "1.2.3.4",
platform => "WS-C6509",
}
},
"%datahash" => {
cdp => { "1.4" => 'fix', "1.5" => 'fix' },
},
};
$a->{"%datahash"}{cdp}{"1.4"} = $a->{"%cdp"}{"1.4"};
};
Does this shed any light on anything? Thanks.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.