How much RAM
- 2 minutes read - 418 wordsWhen someone in IT once asked how much memory I though I would need in a new Windows 10 PC, I said “I always need double”.
I started a new job last week and got a nice Dell Precision laptop, with an Intel Core Ultra 7 155H processor and 32GB of RAM. The processor weirdly has 22 cores. This is made up of 6 performance cores (with 12 threads via hyper-threading), 8 efficiency cores and 2 low power efficiency cores.
When building code, I noticed my laptop freeze and need a hard reboot. After a bit of digging it turned out to be because I was using up all my RAM.
What is using memory
Because modern browsers load each tab in to its own separate instance of the browser engine (for security reasons), they tend to use a lot of RAM. It also makes it hard to work out how much memory they even use since there are so many processes attributed to them. The same goes for any electron app (in my case, VS Code, Firefox, GitKraken, Spotify).
Fortunatly there is a handy command to find and sum all the memory usage (just change the string after the first grep):
ps -eo rss,comm,args | grep /snap/firefox | grep -v grep | awk '{sum+=$1} END {print sum/1024 " MB"}'
and here is how much is being used:
- /usr/local - 83MB
- /user/libexec - 869MB
- Libre - 443MB
- /usr/bin - 1090MB
- docker - 217MB
- /proc/ - 1400MB
- VS Code - 1100MB
- Firefox - 7303MB
- GitKraken - 700MB
- Spotify - 1224MB
- GCC - 12191MB (peak seen, might go a bit higher)
For a total of 26.6GB!
When I was looking through all the wiki pages trying to get up to speed, Firefox was sitting at over 10GB!
Cores Cores Cores
The thing which really pushes it over the limit is GCC, the compiler building C++ code. Most C++ build systems will have a line like this in them
cmake --build . --parallel $(nproc)
which checks how many processor cores there are and run that many threads. As mentioned earlier, I have 22 cores, which gives ~1.45GB of RAM per core. Compare this to my desktop at home, 24 threads and 64GB of RAM = 2.67GB/core.
There are various rules of thumb I have heard for how much RAM you should have, but 2GB/core is the most common I’ve seen.
So if you are building or buying a new PC, or responsible for specing out IT systems, bare this in mind.