Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 949112

Summary: app-editors/zed: High memory consumption during build
Product: Gentoo Linux Reporter: Jonas Frei <freijon>
Component: Current packagesAssignee: Robert G. Siebeck <gentoo.2019>
Status: RESOLVED WORKSFORME    
Severity: normal CC: freijon, gentoo.2019, parona, proxy-maint
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Jonas Frei 2025-01-31 08:36:07 UTC
Today the ebuild contains:

CHECKREQS_DISK_BUILD="8G"  
CHECKREQS_MEMORY="16G"  

However, at least the CHECKREQS_MEMORY requirement seems way too low. During my last compilations, `rustc` consumed up to 29G of RAM. For many users who have set up tmpfs for /var/tmp/portage, this means that a total of at least 38G of RAM is needed. I only have 32GB, so I have to unmount the tmpfs in order to be able to compile this package.

- Is there a way to reduce the memory consumption during the build for this package?  
- If not, the CHECKREQS_MEMORY value should be increased.
Comment 1 Alfred Wingate 2025-01-31 09:30:53 UTC
What sort of makeopts? Maybe it needs qtwebengine treatment with the value getting calculated.
Comment 2 Jonas Frei 2025-01-31 17:03:40 UTC
Portage 3.0.66.1 (python 3.12.8-final-0, default/linux/amd64/23.0, gcc-14, glibc-2.40-r8, 6.12.11-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-6.12.11-gentoo-x86_64-AMD_Ryzen_9_3900X_12-Core_Processor-with-glibc2.40
KiB Mem:    32772060 total,   3444288 free
KiB Swap:   16777212 total,  16768764 free

Timestamp of repository gentoo: Fri, 31 Jan 2025 15:33:30 +0000
Head commit of repository gentoo: b9e2b3f2bbdd0daeabb931a3e523a62ed4b0bf41

sh bash 5.2_p37
ld GNU ld (Gentoo 2.43 p3) 2.43.1
app-misc/pax-utils:        1.3.8::gentoo
app-shells/bash:           5.2_p37::gentoo
dev-build/autoconf:        2.72-r1::gentoo
dev-build/automake:        1.16.5-r2::gentoo
dev-build/cmake:           3.30.6::gentoo
dev-build/libtool:         2.5.4::gentoo
dev-build/make:            4.4.1-r100::gentoo
dev-build/meson:           1.7.0::gentoo
dev-java/java-config:      2.3.4::gentoo
dev-lang/perl:             5.40.0-r1::gentoo
dev-lang/python:           3.12.8_p1::gentoo, 3.13.1_p1::gentoo
dev-lang/rust:             1.84.0::gentoo
llvm-core/clang:           18.1.8-r6::gentoo, 19.1.7::gentoo
llvm-core/lld:             18.1.8::gentoo
llvm-core/llvm:            18.1.8-r6::gentoo, 19.1.7::gentoo
sys-apps/baselayout:       2.17::gentoo
sys-apps/openrc:           0.55.1::gentoo
sys-apps/sandbox:          2.39::gentoo
sys-devel/binutils:        2.43-r2::gentoo
sys-devel/binutils-config: 5.5.2::gentoo
sys-devel/gcc:             14.2.1_p20241221::gentoo
sys-devel/gcc-config:      2.12.1::gentoo
sys-kernel/linux-headers:  6.6-r1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.40-r8::gentoo

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--jobs=25 --load-average=24"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-march=native -O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms split-elog strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -O2 -pipe"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs"
LEX="flex"
MAKEOPTS="-j25 -l24"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/usr/bin/nu"
USE="X acl alsa amd64 bzip2 cairo cet crypt dbus dvd elogind gdbm gif gtk3 iconv ipv6 jpeg libtirpc luajit multilib ncurses nls openmp openssl pam pcre png pulseaudio readline screencast seccomp sqlite ssl test-rust unicode vaapi vulkan wayland x264 x265 xattr zlib" ABI_X86="64" ADA_TARGET="gcc_13" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GUILE_SINGLE_TARGET="3-0" GUILE_TARGETS="3-0" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres16" PYTHON_SINGLE_TARGET="python3_12" PYTHON_TARGETS="python3_12" RUBY_TARGETS="ruby32" VIDEO_CARDS="amdgpu radeonsi" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS

=================================================================
                        Package Settings
=================================================================

app-editors/zed-0.168.2::gentoo was built with the following:
USE="-debug -gles" ABI_X86="(64)" LLVM_SLOT="19 -18"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms split-elog strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
Comment 3 Robert G. Siebeck 2025-02-10 11:41:53 UTC
(In reply to Jonas Frei from comment #0)
> Today the ebuild contains:
> 
> CHECKREQS_DISK_BUILD="8G"  
> CHECKREQS_MEMORY="16G"  
> 
> However, at least the CHECKREQS_MEMORY requirement seems way too low. During
> my last compilations, `rustc` consumed up to 29G of RAM. For many users who
> have set up tmpfs for /var/tmp/portage, this means that a total of at least
> 38G of RAM is needed. I only have 32GB, so I have to unmount the tmpfs in
> order to be able to compile this package.

I was able to compile zed 0.172 with 16GB of RAM with swap enabled.

Please do not confuse the amount of memory REQUIRED to build and the amount of memory it uses if it is available.

> - Is there a way to reduce the memory consumption during the build for this
> package?  

I'm not aware of any.

> - If not, the CHECKREQS_MEMORY value should be increased.

See above, compiling with 16GB works for me.

I think one of the issues is that CHECKREQS_MEMORY does not include swap in the calculation.

Maybe it makes sense to adjust check-reqs.eclass to overcome the limitations mentioned above.