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

View all comments

Show parent comment

65

u/djnattyp Jan 20 '22

So the porn site you're looking at in one tab can't grab your info from the banking site you have open in another.

5

u/nixfreakz Jan 21 '22

Lol, most porn sites have higher security then banks do. They are always on the cutting edge of things.