Hi nonk ,
This theme seems to be quite common , memory gets eaten up and is not released .
The issue is eroding my own confidence in proceeding to develop a perl based tool which I would like to be able to control the release of MEM , when not needed via the best possible code .
On my NT PC / with Perl running under ActiveState , the following code eats up 92,608 KB MEM . After the undef
the MEM usage drops only to 90,572 KB MEM . An awefull lot
of Residual MEM is not returned to the O/S until the program exits .
I know that I am pushing an anonymous array into X , but it really concerns me that undef is not reclaiming the MEM .
Can my code be modified to allow the MEM to be reclaimed to the O/S . I have not found a way
Nova
<code>
#!perl
{
my $i=0 ;
my @X ;
while ( $i < 500000 ) {
push @X ,
$i , $i , $i , $i ;
if ($i%10000==0) { printf "Index %-7d %-7d \n\n" , $i , $X
$i2 ;}
$i++ ;
} ;
printf "Check MEM usage then Return to undef X" ;
<> ;
undef @X ;
};
printf "Enter Return to quit program" ;
<> ;
<\code>
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.