in reply to Re: Memory usage double expected
in thread Memory usage double expected

G'day harangzsolt33,

"vec($A, 19999999, 8) = 0; will give you a string that is exactly 20 million bytes long filled with zero bytes."

All good so far. You have a string of the length you wanted. This works for me.

"So, to fill up the string with letter 'A's, I would probably create a for loop and repeat the following 5 million times: ..."

Or you could just do this once:

$A =~ y/\0/A/;

That works for me. I ran a few tests and that seems to take about five times longer than "$A = 'A' x 20_000_000". Run your own benchmarks, but I think you'd be better off with the 'x' operator.

— Ken