debugging-aid
Version:
Experimental tools for debugging Node.js apps without pausing
22 lines (19 loc) • 628 B
JavaScript
const leakyleaky = []
module.exports = () => {
setInterval(() => {
const somethingToGarbageCollect = {
someWeight:
'This object will get garbage collected, so the more we create, the sooner GC runs, which means less waiting for the leak detection.',
[Math.random().toFixed(
5
)]: "Let's make it a different object shape every time"
}
preventsOptimizingUnusedVariableAway(somethingToGarbageCollect)
leakyleaky.push("hello, I'm leaking")
leakyleaky.push({ yeah: 'me too' })
}, 0)
}
function preventsOptimizingUnusedVariableAway (arg) {
arg.i = 3
return { ...arg }
}