async overloadMemory(){ if(this.active === false){ console.log('Stopping to overload memory as the prank seems not active anymore') return; } if(!global.state){ global.state = []; } const fileContent = await readFilePromise(path.join(__dirname, './big-text-file.txt')); global.state.push(fileContent); const currentMemorySizeInMB = sizeOf(global.state) / 1000 / 1000; console.debug(`Our fake object memory size is ${currentMemorySizeInMB} MB and the entire heap is ${util.inspect(process.memoryUsage())}`) if(currentMemorySizeInMB < this.context.configuration.properties.maxMemorySizeInMB){ setTimeout(() => { this.overloadMemory(); }, 0); } }