Hi All, I am trying to execute a small script using adb commands on windows PC, however I see that there is a memory increase whenever I make a call to "system" command. Could you please let me know how can I make sure that the memory doesn't increase (I am looking at the memory information in task manager). Here is the sample code:
#! /usr/bin/perl use strict; use warnings; use diagnostics; print "########## memory usage of perl start of execution ###########\ +n"; system("tasklist | grep perl"); print "##############################################################\ +n"; for(my $iter = 0; $iter < 5000; $iter++){ system("adb devices"); print "iteration Completed : $iter\n"; } print "########## memory usage of perl end of execution ###########\n +"; system("tasklist | grep perl"); print "##############################################################\ +n";
I am using perl 5.18. the output from the above command looks like this:
########## memory usage of perl start of execution ########### perl.exe 14456 RDP-Tcp#0 1 9,580 K ############################################################## ########## memory usage of perl end of execution ########### perl.exe 14456 RDP-Tcp#0 1 68,420 K ##############################################################
From the output it looks like the memory increased quite a lot during the program execution.

In reply to Memory Usage of Perl System command by pperi2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.