<script> var x = "x"; for (var i = 1; i < 23; ++i) { x = x + x; } // x should now be a 2^23 character string, which is 16M in size. var y; // now append to it repeatedly in a way that prevents buffer sharing for (var i = 0; i < 1000; ++i) { y = x + i; } </script>