It would be useful to measure allocated memory, to always get 3GB back regardless of whether the operating system put the data in RAM or swapped it to disk. 3GB array (=allocated memory) 2.8GB in RAM (=resident memory) Then when I opened a bunch of browser tabs, loading those websites used quite a lot of RAM, and so the operating system decided to swap some data from RAM to disk.Īnd part of the memory that got swapped was from our array.Īs a result, the resident memory for our Python process went down: the data was all still accessible, but some of it had been moved to disk.
3GB array (=allocated memory) 3GB in RAM (=resident memory) In our first example we started out with all 3GB the allocated array stored in RAM. Resident memory is how much of the process’ allocated memory is resident–or stored–in RAM. In particular, it will try to swap data that isn’t actively being used.Īnd now we’re ready to define our first measure of memory usage: resident memory.
If that happens, the operating system will move–or “swap”–some data from RAM to hard drive. Ideally, all of your program’s memory would be stored in fast RAM, but the various processes running on your computer might have allocated more memory than is available in RAM. RAM is fast, and your hard drive is slow… but RAM is also expensive, so typically you’ll have far more hard drive space than RAM.įor example, the computer I’m writing this on has about 500GB of hard drive storage, but only 16GB RAM.