The following code snippet: #include <vector> struct A { std::vector<int> a;}; template<class C> struct B { C c[33]; }; struct Boom { B<B<B<B<A> > > > s; };
seems to make GCC to allocate huge amounts of memory: $ gcc x.cpp virtual memory exhausted: Cannot allocate memory (virtual memory is limited by ulimit to 1GB) $ gcc --version gcc (GCC) 3.4.4 20050721 (Red Hat 3.4.4-2) Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- Summary: gcc requires infinite memory when compiling code snippet Product: gcc Version: 3.4.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sunny at beamfile dot com GCC host triplet: Linux 2.6 GCC target triplet: Linux 2.6 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28819