szabgab has asked for the wisdom of the Perl Monks concerning the following question:
using htop I see the script is uing 2Gb memory.$mem = "A" x 1024 ** 3;
Am I missing something or is that Perl created the 1Gb string in memory and then copies it tho $mem and does not release the original? With the emphasize on "copy".
Further "research" shows that this code reports the usage of 3Gb memory and swapped out my browser so it is now very slow to type :).
$mem = "A" x 1024 ** 3; $t = $mem;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: memory usage
by CountZero (Bishop) on Jan 16, 2012 at 13:17 UTC | |
|
Re: memory usage
by BrowserUk (Patriarch) on Jan 16, 2012 at 17:17 UTC | |
|
Re: memory usage
by Anonymous Monk on Jan 16, 2012 at 12:43 UTC | |
|
Re: memory usage
by locked_user sundialsvc4 (Abbot) on Jan 16, 2012 at 17:07 UTC |