in reply to Memory usage double expected
For investigating this further (in Linux):
print "pid:$$\n"; my $x = 'monks' x (3); sleep 60;
and then use gcore <pid> to dump the memory of said process to file (called core.<pid>) and then find occurences of "monks" either with strings core.<pid> | grep monks or hexdump -C core.<pid> | grep monks
true to what the explanation offered to perlmonks above, the anonymous monk firstly:
print "$$\n"; my $n = 3; $x = 'monks' x ($n); sleep 60;
monksmonksmonks monks
contrast to
print "$$\n"; $x = 'monks' x (3); sleep 60;
monksmonksmonks monksmonksmonks monksmon<
bw, bliako
|
|---|