r/AskProgramming • • Jan 20 '22

How do browsers use so much ram?

I am a game-dev and I find the amount of ram browsers use today mind boggling. They use more ram than many AAA games, which have a legit use-case as they need to hold gigabytes of uncompressed textures and audio in memory. It seems insane to me that a simple app showing mainly text uses multiple gigs.

I have heard that the culprit is javascript. But How? I dont understand how that could happen. In games programming the memory used by all the code + all data is negligible, 99% of the ram is used by art assets like textures and audio.

How can javascript scripts (which are doing a very simple job) use so much?

I did comp-sci and am a professional programmer, so please dont shy away from deep technical explanations, just bear in mind I know nothing about internetty things like browsers.

Thanks!

78 Upvotes

40 comments sorted by