Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

Reproduction For #4437

node v18.11.0
endpointsharetweet
function formatMemoryUsage(bytes) { return `${(bytes / 1024 / 1024).toFixed(2)} MB`; } function logMemoryUsage() { const usage = process.memoryUsage(); console.log(`Memory Usage: Heap Total: ${formatMemoryUsage(usage.heapTotal)}, Heap Used: ${formatMemoryUsage(usage.heapUsed)}`); } // Simulate string slicing operations function simulateStringSlicing() { let str = 'a'.repeat(10 * 1024 * 1024); // 10 MB string let slicedArray = []; // Simulate slicing for (let i = 0; i < 1000; i++) { let sliced = str.slice(i, i + Math.floor(Math.random() * 100)); slicedArray.push(sliced); } } let count = 0; const intervalId = setInterval(() => { simulateStringSlicing(); logMemoryUsage(); count++; if (count === 25) { clearInterval(intervalId); // Stop the interval after 25 executions } }, 1000);
Loading…

no comments

    sign in to comment