in reply to Re^2: Memory Usage of Perl System command
in thread Memory Usage of Perl System command

And what do you get if you run the exact same thing, but just iterating once, 10 times, 100 times and perhaps 1,000 times, instead of 5,000 times on your system call?

My gut-feeling idea is that the number of times you run your command is probably irrelevant to a large extent. Which would mean that you have a memory penalty for the first system call, but not really for the others, so that the memory usage would appear to be mostly reclaimed by the Perl process between the various calls. But that's only a guess, I don't really know and can't run the exact same tests. But relatively similar tests lead me to think that's probably what you will experience.

  • Comment on Re^3: Memory Usage of Perl System command

Replies are listed 'Best First'.
Re^4: Memory Usage of Perl System command
by pperi2 (Novice) on Jan 09, 2016 at 00:53 UTC

    as per your suggestion, I changed the code to get the memory usage for each iteration as shown below:

    ############################################################## ########## memory usage of perl start of execution for iter: 0 ####### +#### perl.exe 18124 RDP-Tcp#0 1 9,544 K ############################################################## ########## memory usage of perl end of execution for iter: 0 ######## +### perl.exe 18124 RDP-Tcp#0 1 9,580 K ############################################################## iteration Completed : 0 ########## memory usage of perl start of execution for iter: 1 ####### +#### perl.exe 18124 RDP-Tcp#0 1 9,588 K ############################################################## ########## memory usage of perl end of execution for iter: 1 ######## +### perl.exe 18124 RDP-Tcp#0 1 9,624 K ############################################################## iteration Completed : 1 ########## memory usage of perl start of execution for iter: 2 ####### +#### perl.exe 18124 RDP-Tcp#0 1 9,640 K ############################################################## ########## memory usage of perl end of execution for iter: 2 ######## +### perl.exe 18124 RDP-Tcp#0 1 9,668 K ############################################################## iteration Completed : 2
    after 40 iterations memory has been increased as shown below:
    ########## memory usage of perl start of execution for iter: 45 ###### +##### perl.exe 18124 RDP-Tcp#0 1 11,308 K ############################################################## ########## memory usage of perl end of execution for iter: 45 ####### +#### perl.exe 18124 RDP-Tcp#0 1 11,324 K ############################################################## iteration Completed : 45 ########## memory usage of perl start of execution for iter: 46 ###### +##### perl.exe 18124 RDP-Tcp#0 1 11,332 K ############################################################## ########## memory usage of perl end of execution for iter: 46 ####### +#### perl.exe 18124 RDP-Tcp#0 1 11,348 K ############################################################## iteration Completed : 46 ########## memory usage of perl start of execution for iter: 47 ###### +##### perl.exe 18124 RDP-Tcp#0 1 11,356 K ############################################################## ########## memory usage of perl end of execution for iter: 47 ####### +#### perl.exe 18124 RDP-Tcp#0 1 11,368 K ############################################################## iteration Completed : 47 ########## memory usage of perl start of execution for iter: 48 ###### +##### perl.exe 18124 RDP-Tcp#0 1 11,376 K ############################################################## ########## memory usage of perl end of execution for iter: 48 ####### +#### perl.exe 18124 RDP-Tcp#0 1 11,392 K ############################################################## iteration Completed : 48 ########## memory usage of perl start of execution for iter: 49 ###### +##### perl.exe 18124 RDP-Tcp#0 1 11,404 K ############################################################## ########## memory usage of perl end of execution for iter: 49 ####### +#### perl.exe 18124 RDP-Tcp#0 1 11,504 K ############################################################## iteration Completed : 49 ########## memory usage of perl end of execution ########### perl.exe 18124 RDP-Tcp#0 1 11,512 K ##############################################################
    BTW as mentioned by Mr.Muskrat, I tried the script on linux station and the issue is not seen.