You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One concern with ninja for C++ projects is the high memory usage. For example, I have 8 GB of memory and 4 cores/8 threads on one of my machines and last I tried ninja, it using all available CPU caused the machine to halt from OOM. For make, I limit myself to j4 on that machine. Not sure if there is a way to limit meory given to ninja.
-j4 reduces the memory only as a side effect. The option actually limits the number of parallel jobs to 4 at maximum. Ninja has the exact same option, so ninja -j4 should behave similar to make -j4. Maybe, it is a good idea to propagate this argument to the user? So build.sh e.g. uses all 32 cores by default (much faster given that enough RAM is available) but can be limited with build.sh -jX to use less cores.
I wasn't aware controlling jobs was possible in ninja. I guess I never checked? Thanks haha. I like the idea of giving build.sh an optional -j argument.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This has the main advantage that ninja uses all cores per default resulting in a faster compilation on machines with more or less than 4 cores.
See #302 for more discussion.