Amine wrote: > How can i 'force' Perl to return the used memory ?
You cannot. This memory is actually free, you can still use it in your program, as you can see when you run "func" once again. Or, as your question partially suggests, use threads: ending a thread will release the memory back to OS. > When you will run this script , you will see that the > second call to func() does take a lot of time(much more > than the first call) , why ? It takes the same time for me (I've changed one million to five): #!/usr/bin/perl; use strict; use warnings; use Time::HiRes qw/time/; my $time = time; sub func { my @b; for (my $i=0;$i<5000000;$i++) { $b[$i] = 'Perl';} undef @b; print '@b memory returned..'; print $time - time, "sec\n"; } func; print $time - time, "sec\n"; func; print $time - time, "sec\n"; func; print $time - time, "sec\n"; print "end ...\n"; -- Serguei Trouchelle _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs