http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56671
Bug #: 56671
Summary: Gcc uses large amounts of memory and processor power
with large C++11 bitsets
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
When I attempt to instantiate std::bitset<1024*1024*1024> in C++98 mode,
compilation takes a quarter-second and uses almost no RAM. In C++11 mode, it
takes 8 seconds and almost 2GB of RAM. The time and memory usage appear to
scale linearly with the size of the bitset. No errors or warnings are reported
in either mode.
Full code:
#include <bitset>
int main()
{
std::bitset<1024*1024*1024> bs;
}
Compilation lines:
g++ -std=c++98 x.cpp
g++ -std=c++11 x.cpp
g++ -v:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/src/gcc-4.7.2/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
--enable-libstdcxx-time --enable-gnu-unique-object --enable-linker-build-id
--with-ppl --enable-cloog-backend=isl --disable-ppl-version-check
--disable-cloog-version-check --enable-lto --enable-gold --enable-ld=default
--enable-plugin --with-plugin-ld=ld.gold --with-linker-hash-style=gnu
--enable-multilib --disable-libssp --disable-build-with-cxx
--disable-build-poststage1-with-cxx --enable-checking=release
Thread model: posix
gcc version 4.7.2 (GCC)