<pre style='margin:0'>
Joshua Root (jmroot) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/86c02d3b1a4caba0573116954479a7119e4542fb">https://github.com/macports/macports-base/commit/86c02d3b1a4caba0573116954479a7119e4542fb</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new 86c02d3b1 Add build.mem_per_job option
</span>86c02d3b1 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit 86c02d3b1a4caba0573116954479a7119e4542fb
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Sat Jul 13 04:23:46 2024 +1000
<span style='display:block; white-space:pre;color:#404040;'> Add build.mem_per_job option
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Specifies how many MiB of memory each parallel build job is expected to
</span><span style='display:block; white-space:pre;color:#404040;'> use, and is used to limit the default number of build.jobs to avoid
</span><span style='display:block; white-space:pre;color:#404040;'> exhausting memory.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Closes: https://trac.macports.org/ticket/62554
</span>---
src/port1.0/portbuild.tcl | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/port1.0/portbuild.tcl b/src/port1.0/portbuild.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 344dfaceb..52dcbbbbd 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/port1.0/portbuild.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/port1.0/portbuild.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -46,6 +46,7 @@ namespace eval portbuild {
</span> options build.asroot \
build.jobs \
build.jobs_arg \
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ build.mem_per_job \
</span> build.target \
use_parallel_build
commands build
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -56,6 +57,7 @@ default build.cmd {[portbuild::build_getmaketype]}
</span> default build.nice {${buildnicevalue}}
default build.jobs {[portbuild::build_getjobs]}
default build.jobs_arg {[portbuild::build_getjobsarg]}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+default build.mem_per_job 1024
</span> default build.pre_args {[portbuild::build_getargs]}
default build.target all
default build.type default
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -157,8 +159,10 @@ proc portbuild::build_getjobs {args} {
</span>
macports_try -pass_signal {
set memsize [sysctl hw.memsize]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$jobs > $memsize / (1024 * 1024 * 1024) + 1} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set jobs [expr {$memsize / (1024 * 1024 * 1024) + 1}]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global build.mem_per_job
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set jobs_limit_mem [expr {int($memsize / (${build.mem_per_job} * 1024 * 1024)) + 1}]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$jobs > $jobs_limit_mem} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set jobs $jobs_limit_mem
</span> }
} on error {} {}
}
</pre><pre style='margin:0'>
</pre>