[Bug c++/12487] New: memory leaks with 'class X { std::list<X> t; };'

ant_diaz at teleline dot es gcc-bugzilla@gcc.gnu.org
Thu Oct 2 00:55:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12487

           Summary: memory leaks with 'class X { std::list<X> t; };'
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: critical
          Priority: P1
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ant_diaz at teleline dot es
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i586-linux-gnu
  GCC host triplet: i586-linux-gnu
GCC target triplet: i586-linux-gnu

The following example compiles without problem with g++ 3.3.1 (glibc 2.3.1). But
the produced executable runs out of memory in no time.

  g++ -Wall -W -o test main.cc
  ./test
  Out of memory

  g++ -v
  Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnu/3.3.1/specs
  Configured with: ../gcc-3.3.1/configure --enable-languages=c,c++ --disable-nls
  Thread model: posix
  gcc version 3.3.1

Doesn't occur if:
  replacing 'list' with 'vector'
  using g++ 3.2.2 (glibc 2.3.1)
  using egcs 1.1.2 (glibc 2.1)

-------- EXAMPLE BEGINS -------
#include <list>

class X { std::list<X> t; };

void f1() { X x; };

int main()
  {
  while( true ) f1();
  return 0;
  }
------- EXAMPLE ENDS -------



More information about the Gcc-bugs mailing list