in reply to understanding devel::leak
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>
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>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: understanding devel::leak
by almut (Canon) on Oct 04, 2007 at 16:18 UTC | |
by Nova (Novice) on Oct 05, 2007 at 15:57 UTC | |
by almut (Canon) on Oct 05, 2007 at 21:38 UTC | |
by Nova (Novice) on Oct 07, 2007 at 01:07 UTC | |
Re^2: understanding devel::leak
by diotalevi (Canon) on Oct 04, 2007 at 20:19 UTC | |
by nonnonymousnonk (Novice) on Oct 09, 2007 at 17:18 UTC |
In Section
Seekers of Perl Wisdom