-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory use during build #45949
Comments
I'm personally always doing |
I bet you have a bit more RAM? |
You can serialize them with flock(1):
|
I'm using Yocto recipe, let's see if I can force that to use flock, thanks for the tip! |
@bnoordhuis that is brilliant. Thank you!. The yocto recipe already has:
I inserted This makes an enormous difference in my Yocto image build time (nodejs was the dominant factor). |
On build hosts with more cores then RAM it is benificial to compile on as many threads as possible (though on average you need about 1GB RAM per thread). During the link stage make will try to link up to 5 executables, each requiring up to 5GB. On machines with less the 20GB RAM this will thrash the disk or OOM. To prevent that from happening force serializing the link, so only 5GB RAM is required. link: nodejs/node#45949 Suggested-by: @bnoordhuis Signed-off-by: Ferry Toth <ftoth@exalondelft.nl>
On build hosts with more cores then RAM it is benificial to compile on as many threads as possible (though on average you need about 1GB RAM per thread). During the link stage make will try to link up to 5 executables, each requiring up to 5GB. On machines with less the 20GB RAM this will thrash the disk or OOM. To prevent that from happening force serializing the link, so only 5GB RAM is required. link: nodejs/node#45949 Suggested-by: @bnoordhuis Signed-off-by: Ferry Toth <ftoth@exalondelft.nl>
What is the problem this feature will solve?
My build machine is 8 cores / 16 threads. It has 16GB RAM. If I build with
make -j 16
the compile stage takes about 30 min. But during link 5 executables are being linked simultaneously, each taking 4GB RAM. Disk thrashing starts and the link phase takes an extreme long time to complete. In the mean while keyboard/mouse stop responding.Alternative I can set
make -j 2
in which case the compile phase takes multiple hours.I would like only one executable linked at a time, but compiling to respect 16 threads.
What is the feature you are proposing to solve the problem?
Possibly a hard coded limit in the makefile. Or a command line switch.
What alternatives have you considered?
Other then buying more RAM, I can send SIGSTOP from over ssh (seems to respond better then local terminal). The stopped linkers are swapped out and not swapped back in. Then I can SIGCONT one by one. This works but requires manual intervention.
The text was updated successfully, but these errors were encountered: