An improved version of the script at link text. This is faster since it uses join, and lets the browser have some time to update the page evey now and then.
function allocate_mem() {
var mega=[];
// Strings are stored as UTF-16 = 2 bytes per character.
// Below a 1Mibi byte string is created
for(var i=0; i<65536; i++){
mega.push('12345678')
}
mega=mega.join("");
var x=document.getElementById("max_mem");
var size=0;
var large=[];
function allocate( ) {
++size;
//if (size>400) {alert(large.join("").length/1048576); return; }
large.push("."+mega.slice(0));
x.innerHTML = "max memory = " + size + " MB";
setTimeout(allocate, size %10 ? 0: 200);
}
allocate();
}