JSFiddle - React, Tailwind, and code Playground
HTML
<button id="btn">once</button>
<button id="btn-s">simulate</button>
JavaScript
/**
Chrome memory stress test.
1. open Developers tools
2. click simulate button 1 or more time.
3. wait
4. every simulate click setup an interval the log some message to the console.
the test will show how much memory the console.log will allocate, and if it will eventually cause a crash or just
use all the machine memory.
**/
function makeid()
{
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for( var i=0; i < 5; i++ )
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
function a(){
for(i=0;i<100;i++){
var g = {}
g.a = makeid()+makeid()+makeid()+makeid()
g.b = makeid()+makeid()+makeid()+makeid()
g.c = makeid()+makeid()+makeid()+makeid()
g.d = makeid()+makeid()+makeid()+makeid()
g.e = makeid()+makeid()+makeid()+makeid()
g.f = makeid()+makeid()+makeid()+makeid()
g.g = makeid()+makeid()+makeid()+makeid()
g.h = makeid()+makeid()+makeid()+makeid()
g.i = makeid()+makeid()+makeid()+makeid()
g.j = makeid()+makeid()+makeid()+makeid()
g.k = makeid()+makeid()+makeid()+makeid()
g.l = makeid()+makeid()+makeid()+makeid()
g.m = makeid()+makeid()+makeid()+makeid();
console.log(g);
}
}
function simulate(){
setInterval(c,5*1000);
}
function c(){
for(i=0;i<100;i++){
a();
}
}
$("#btn").click(c);
$("#btn-s").click(simulate);