Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 340030 - sys-devel/gcc-4.4.3-r2 eats all RAM
Summary: sys-devel/gcc-4.4.3-r2 eats all RAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
Depends on:
Reported: 2010-10-07 08:01 UTC by Christopher Head
Modified: 2011-09-27 19:43 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---

The source tree triggering the issue (killer.tar.bz2,23.84 KB, application/octet-stream)
2010-10-07 08:04 UTC, Christopher Head
A pared-down version of the sources (killer.tar.bz2,743 bytes, application/octet-stream)
2010-10-08 00:21 UTC, Christopher Head

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Head 2010-10-07 08:01:50 UTC
When compiling a certain (erroneous, but not hideously so—nothing more than a couple of references to undeclared symbols!) source file, G++ eats every last byte of RAM and swap it can get its hands on (16GB all told) before crashing (which, in the case of using swap, takes a VERY long time). The code doesn't seem sufficiently horribly wrong that it ought to have this kind of effect, and from an idealistic point of view, *no* input ought to cause this kind of behaviour.

I will upload a tarball of the necessary source files, plus a shell script with the compiler command line, necessary to expose the bug.

I'm labelling this as critical because once it starts thrashing swap, your only choice is to wander off and leave your machine for half an hour (more or less, depending on how big and how fast your swap is), or power cycle it and destroy all unsaved work.

Reproducible: Always

Steps to Reproduce:
1. Install dev-cpp/glibmm-2.24.2-r1, dev-cpp/gtkmm-2.20.3, and dev-libs/protobuf-2.3.0-r1 (glibmm and gtkmm are current stable; protobuf has no stable version but 2.3.0-r1 is the latest in the tree).
2. Unpack the attached tarball.
3. "cd" into the directory.
4. Run "./".
Actual Results:  
$ ./
log/analyzer.cpp:251: warning: unused parameter ‘data’
log/analyzer.cpp:251: warning: unused parameter ‘length’
log/analyzer.cpp:727: error: ‘packet_generic_bool_compute_flags’ was not declared in this scope
log/analyzer.cpp:727: error: ‘packet_generic_bool_build_tree’ was not declared in this scope
virtual memory exhausted: Cannot allocate memory

Expected Results:  
$ ./
log/analyzer.cpp:251: warning: unused parameter ‘data’
log/analyzer.cpp:251: warning: unused parameter ‘length’
log/analyzer.cpp:727: error: ‘packet_generic_bool_compute_flags’ was not declared in this scope
log/analyzer.cpp:727: error: ‘packet_generic_bool_build_tree’ was not declared in this scope

# emerge --info sys-devel/gcc
Portage (default/linux/amd64/10.0, gcc-4.4.3, glibc-2.11.2-r0, 2.6.35-gentoo-r4 x86_64)
                        System Settings
System uname: Linux-2.6.35-gentoo-r4-x86_64-Intel-R-_Core-TM-_i7_CPU_Q_720_@_1.60GHz-with-gentoo-1.12.13
Timestamp of tree: Thu, 07 Oct 2010 06:45:03 +0000
app-shells/bash:     4.0_p37
dev-java/java-config: 2.1.11
dev-lang/python:     2.6.5-r3, 3.1.2-r4
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    2.3-r1
sys-devel/autoconf:  2.13, 2.65-r1
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.3-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.30-r1
ACCEPT_LICENSE="* -@EULA dlj-1.1 sun-bcla-java-vm AdobeFlash-10.1"
CFLAGS="-march=core2 -msse4 -mcx16 -mpopcnt -msahf -O2 -pipe"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=core2 -msse4 -mcx16 -mpopcnt -msahf -O2 -pipe"
FEATURES="assume-digests distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms splitdebug strict unmerge-logs unmerge-orphans userfetch"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en en_CA"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTDIR_OVERLAY="/var/lib/layman/sunrise /usr/local/portage"
USE="X a52 aac acpi alsa amd64 bzip2 cairo caps cdda cddb cdinstall cdio cli cups custom-optimization cvs cxx dbus dillo double-precision dri dvd faac faad fat ffmpeg fftw flac fortran gcrypt gif gimp git glibc-omitfp gmp gnutls gtk hal hou hpn idn imap iphone java java6 jce joystick jpeg laptop libsamplerate mercurial mikmod mmx modules mp3 mpeg multilib multiuser ncurses nls nntp nowin nptl nptlonly ntfs ntp offensive ogg opengl openmp pam pdf plotutils png ppds pppd qq readline reflection scanner sdl session sou sparse spell sse sse2 ssse3 startup-notification stream subversion svg symlink sysfs taglib theora thunar timidity truetype unicode usb v4l2 videos vim-syntax vorbis xinerama xorg xscreensaver xulrunner xv xvid xvmc zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en en_CA" QEMU_SOFTMMU_TARGETS="i386 x86_64" RUBY_TARGETS="ruby18" SANE_BACKENDS="plustek" USERLAND="GNU" XFCE_PLUGINS="menu" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 

                        Package Settings

sys-devel/gcc-4.4.3-r2 was built with the following:
USE="doc fortran gtk (multilib) nls nptl openmp (-altivec) -bootstrap -build (-fixed-point) -gcj -graphite (-hardened) (-libffi) -mudflap -multislot (-n32) (-n64) -nocxx -objc -objc++ -objc-gc -test -vanilla" 
CFLAGS="-march=core2 -O2 -pipe"
CXXFLAGS="-march=core2 -O2 -pipe"
Comment 1 Christopher Head 2010-10-07 08:04:55 UTC
Created attachment 249817 [details]
The source tree triggering the issue

WARNING! DO *NOT* run with unsaved work! Also, consider swapoffing before running it at all!

Also, *fixing* the compile errors (by changing "bool" to "boolean" in the two undeclared symbols on line 727, thus referring to the functions they were intended to refer to, makes this problem go away and the compile finish normally.
Comment 2 Christopher Head 2010-10-08 00:21:28 UTC
Created attachment 249900 [details]
A pared-down version of the sources

This pares down the source code to a total of 17 lines in one file and removes the dependency on protobuf. Problem is the same.
Comment 3 SpOeK 2010-10-08 10:18:32 UTC
(In reply to comment #2)
> Created an attachment (id=249900) [details]
> A pared-down version of the sources
> This pares down the source code to a total of 17 lines in one file and removes
> the dependency on protobuf. Problem is the same.
Same here. Your test code gave me this output: "virtual memory exhausted: Cannot allocate memory".

Besides, I'm developing some software in C++ that leads to the same end: no free memory and oom-killer taking down some processes.

Comment 4 Christopher Head 2011-09-27 19:16:07 UTC
Appears to be fixed in sys-devel/gcc-4.5.3-r1.