tobias_hofer has asked for the wisdom of the Perl Monks concerning the following question:
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:
However, some of those modules have some globals which will be accessed/filled during the test run - in example:
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 ?
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:
The test-system itself and the test-code are using the same modules for accessing global variables.$para_return = &{ $tc_module."::".$para_init_func } ();
However, some of those modules have some globals which will be accessed/filled during the test run - in example:
Now the badest. Some of these modules include each other, and modules are loaded several times.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;
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 ?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Memory usage of array and hashe variables by multiple inclusion.
by kcott (Archbishop) on Jul 02, 2013 at 11:25 UTC | |
by tobias_hofer (Friar) on Jul 02, 2013 at 11:31 UTC | |
Re: Memory usage of array and hashe variables by multiple inclusion.
by flexvault (Monsignor) on Jul 02, 2013 at 13:16 UTC | |
by tobias_hofer (Friar) on Jul 02, 2013 at 14:49 UTC | |
Re: Memory usage of array and hashe variables by multiple inclusion.
by sundialsvc4 (Abbot) on Jul 02, 2013 at 13:51 UTC |
Back to
Seekers of Perl Wisdom