Eli5: Why don’t computer games use all available RAM?

363 views

For example, there’s a racing game I play that is a 20GB total install and I have 32GB RAM. The game never uses more than 5GB RAM.

Why does it unload and reload between races? Wouldn’t it make sense to keep everything in RAM after it’s loaded it once?

In: 0

6 Answers

Anonymous 0 Comments

The amount of space it takes on the disc has very little to do with the amount of ram it needs to use while playing.

The space it takes on the disc is just the program itself, which is the instructions that tells the computer how to run the game. The computer then uses ram when carrying out those instructions. Yes this is an oversimplification, but that is the general gist.

Consider this: I write on a sheet of paper the following set of instructions:

1. On a separate sheet of paper, write the letter ‘A’
2. Repeat step 1 forever.

The instructions themselves takes up very little space. Just two written lines on a sheet of paper. But if you carried out those instructions, well, you’d need an infinite amount of paper.

On the flipside, I could have a large amount of instructions that very meticulously spell out how to draw a circle, taking up hundreds and hundreds of pages but, at the end of the day, all you will have done is just used up a single page to draw a circle.

As to why it unloads and reloads when there is available RAM to just store all the levels. Well firstly, one goal of program design is to try and use a few resources as are necessary. It’s not a given that you’ll actually need a level till you get there, so there is no point in loading that level into memory until then. For example, if you die or quit before reaching that level, then it will have been loaded into memory for nothing.

But given all of that, there is a very good reason why a single program doesn’t use up all the memory available: because then there wouldn’t be any available for other programs to run. A computer isn’t ever only doing one thing. It’s doing lots of things, and those things need memory, too.

You are viewing 1 out of 6 answers, click here to view all answers.