RAM usage during CS (and C++) compilation
Posted: Thu Aug 20 2020 1:11 am
Hello,
I was checking out CS and now have a question: how much RAM do your workstations generally have and how many jobs you launch to compile CS?
During building full version of CS I've experienced by trial and error (I mean OOM killer ) that with 16 GB of RAM I can safely use about 4 jobs (out of 12 available) in ninja with g++ 10. Let's assume that the rest of the desktop takes around 4 GB, so I will count that in straight away and decrease the available amount of RAM to 12. Most of the time the RAM usage stayed around 4 GB, going up to 12 at certain times, and a few times for a short period of time it went over 12 GB of RAM and additionally consumed around 10-15 GB of swap. I have tried gold.ld instead of default ld but I didn't notice any difference.
Does that mean you need to plan for about 6 GB of RAM per job at critical times and perhaps even up to 8 GB? This means that you need to have 64 GB of RAM at a minimum to comfortably use the full power of 12-core CPU and additionally 10-20 GB of swap reserved for critical sections of compilation.
I am also curious as to what causes such huge memory requirements. I am not proficient in C++ yet and I don't have a lot of experience writing software in this language. I tried to find info by searching for "c++ compilation ram usage" but didn't find any substantial evidence, measurements and logical conclusions on the topic. Perhaps you can provide some educated guesses?
I was checking out CS and now have a question: how much RAM do your workstations generally have and how many jobs you launch to compile CS?
During building full version of CS I've experienced by trial and error (I mean OOM killer ) that with 16 GB of RAM I can safely use about 4 jobs (out of 12 available) in ninja with g++ 10. Let's assume that the rest of the desktop takes around 4 GB, so I will count that in straight away and decrease the available amount of RAM to 12. Most of the time the RAM usage stayed around 4 GB, going up to 12 at certain times, and a few times for a short period of time it went over 12 GB of RAM and additionally consumed around 10-15 GB of swap. I have tried gold.ld instead of default ld but I didn't notice any difference.
Does that mean you need to plan for about 6 GB of RAM per job at critical times and perhaps even up to 8 GB? This means that you need to have 64 GB of RAM at a minimum to comfortably use the full power of 12-core CPU and additionally 10-20 GB of swap reserved for critical sections of compilation.
I am also curious as to what causes such huge memory requirements. I am not proficient in C++ yet and I don't have a lot of experience writing software in this language. I tried to find info by searching for "c++ compilation ram usage" but didn't find any substantial evidence, measurements and logical conclusions on the topic. Perhaps you can provide some educated guesses?