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.
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’re mixing up 2+ things here. Space on a storage drive (probably some flavor of SSD on a modern machine) which is the 20 gig install, RAM which contains information used by actively running programs which the game apparently needs about 5 gigs of, and VRAM which is a lot like the normal RAM but physically located on your graphics card and mostly dedicated to loading up textures & other large files the GPU needs exclusive and lightning fast access to — high end cards these days will have 10+ gigs of it and a modern game with 4k textures can eat up a lot of it.
And like the other commenter describes, the main reason not to keep an entire program’s install in RAM on launch (because RAM gets wiped between reboots) is that any decent program should never *assume* it maxing out your resources is desireable, especially if doing so brings very little gain. Most people don’t have enough RAM to load up an entire game (certainly not most modern games), so those games can’t be designed around that general strategy. Some will let you tweak these settings (the chunk loading limit of Minecraft is a decent example) to better take advantage of specific hardware, but this is dependent on the overall design of the game and adds development work (you can’t load up 10% more race without getting creative in ways that might lead to more debugging effort).
You’re mixing up 2+ things here. Space on a storage drive (probably some flavor of SSD on a modern machine) which is the 20 gig install, RAM which contains information used by actively running programs which the game apparently needs about 5 gigs of, and VRAM which is a lot like the normal RAM but physically located on your graphics card and mostly dedicated to loading up textures & other large files the GPU needs exclusive and lightning fast access to — high end cards these days will have 10+ gigs of it and a modern game with 4k textures can eat up a lot of it.
And like the other commenter describes, the main reason not to keep an entire program’s install in RAM on launch (because RAM gets wiped between reboots) is that any decent program should never *assume* it maxing out your resources is desireable, especially if doing so brings very little gain. Most people don’t have enough RAM to load up an entire game (certainly not most modern games), so those games can’t be designed around that general strategy. Some will let you tweak these settings (the chunk loading limit of Minecraft is a decent example) to better take advantage of specific hardware, but this is dependent on the overall design of the game and adds development work (you can’t load up 10% more race without getting creative in ways that might lead to more debugging effort).
It delegates that to the OS. A program has to work on the assumption that it is not the only thing running on the computer, and it cannot hog all memory. If it wanted to use all the RAM for caching, it would need to coordinate with the OS to gracefully release some of the memory back when something else needs it. But the OS itself also does file caching in unused regions of the RAM! So the program can just unload the asset, and assuming it’s not expensive to unpack it from the file format, it can just load it again and count on the OS to give it the memory cached file if it hasn’t been evicted from the OS cache yet. So, there is cache, it’s just counted for the OS cache in task manager, not the program.
Then there is Cities Skylines which gives nary a fuck and just allocates 40 gigabytes to load a few dozen building models.
It delegates that to the OS. A program has to work on the assumption that it is not the only thing running on the computer, and it cannot hog all memory. If it wanted to use all the RAM for caching, it would need to coordinate with the OS to gracefully release some of the memory back when something else needs it. But the OS itself also does file caching in unused regions of the RAM! So the program can just unload the asset, and assuming it’s not expensive to unpack it from the file format, it can just load it again and count on the OS to give it the memory cached file if it hasn’t been evicted from the OS cache yet. So, there is cache, it’s just counted for the OS cache in task manager, not the program.
Then there is Cities Skylines which gives nary a fuck and just allocates 40 gigabytes to load a few dozen building models.
Latest Answers