Chrome dev tools first memory heap snapshot is mysteriously large Chrome dev tools first memory heap snapshot is mysteriously large google-chrome google-chrome

Chrome dev tools first memory heap snapshot is mysteriously large


Right before memory snapshot is taken Chrome tries to collect the garbage. It doesn't collect it thoroughly though, it only does a predefined number of passes (this magic number seems to be 7). Therefore, when the first snapshot is taken there still might be some uncollected garbage left.

Before making a first snapshot try going to the "Timeline" tab and forcing garbage collection manually.

Forcing garbage collection in Chrome DevTools

From what I've tested, this always reduces the size of the first snapshot.

Memory snapshots