Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hello Monks

I am facing an increasing memory usage over the time (during the application-run) and i am not shure what could be the root-cause.
Ok.. I got here a test-system written in perl (not by me) which is loading test-code (also written in perl)more or less dynamically like this:
$para_return = &{ $tc_module."::".$para_init_func } ();
The test-system itself and the test-code are using the same modules for accessing global variables.
However, some of those modules have some globals which will be accessed/filled during the test run - in example:
our $VERDICT = VERDICT_NONE; our @ACTUAL_ERROR_CODES = (); our %TC_PARAMETER = (); our %TC_PRJ_PARAMETER = (); our @TC_HTML_TEXT = (); our $REPEAT_TC_FLAG = 0; my $ALL_ERR_CODES = {}; my $ErrorHandler = ITF::ErrorHandler->new(); my @SYS_FAIL_ERRORS = qw( 111 112 113 100 160 ); my $current_loglevel; my $initial_loglevel; my $current_TC_ID; my %All_ZipFile_to_Handle; my %All_ZipHandle_to_File; my %Alive_Hosts; my %PUBLIC_VARS; our %EVAL_COLLECTION;
Now the badest. Some of these modules include each other, and modules are loaded several times.

Can modules be loaded several times?

Now my wild guess, in case modules can be loaded several times the global vars stay as they are but during the "use" the local vars and objects are created each time the module is loaded. Thus the memory increases - I guess ?

Am I right or completely wrong?

Is there in perl something like the include-protection in C ?

In reply to Memory usage of array and hashe variables by multiple inclusion. by tobias_hofer

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (6)
    As of 2018-05-27 14:53 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Notices?