in reply to Memory usage double expected

If that's any help, linux's pmap also reports 8615556K

Edit:

Could it be because Perl (and others) re-allocates the size of $x to double the last requested size? Unlikely if total_size reports 4Gb I guess.

Try reading a large file instead of creating a huge scalar in $x.