When I start a new thread which executes the following code, the memory will grow rapidly, and cause the app to crash.
setInterval(function () {
let str = generateLongString(1000 * 1000 * 10); // generate a string with 10M bytes.
str = null;
}, 0);
I use this piece of code to inject memory stress to the phone. I tried the same code in my browser. The memory will be collected by the browser's GC properly.
When I start a new thread which executes the following code, the memory will grow rapidly, and cause the app to crash.
I use this piece of code to inject memory stress to the phone. I tried the same code in my browser. The memory will be collected by the browser's GC properly.