Description of problem: When I compile a small C++ program with templates and <iostream> with g++ 3.2 and debug it with Kdbg, then when stepping through the program at some moment Kdbg hangs, and with "top" i can see that gdb is acquiring all the RAM it can get. Compiling exactly the same source with g++ 2.96 does not lead to any problems. How reproducible: Always Steps to Reproduce: 1. Type: cat > test.cpp #include <string> #include <iostream> using namespace std; template<class X> void out (ostream& in, X& x) { // Here gdb starts allocating as much memory as it can get // eventually leading to system freeze cout << x; } int main() { cout << "This works fine!"; out(cout, "aaa"); } 2. Compile g++ -g test.cpp 3. [IMPORTANT] Be ready to kill gdb process or the system will freeze quite fast (thrashing). 4. Debug "a.out" kdbg a.out 5. Step through the program. Actual Results: When stepping through function body: template<class X> void out (ostream& in, X& x) { cout << x; } gdb will start acuquiring immence amounts of memory. [Be ready to kill the process!] Additional info: * The same behaviour also occurs when replacing cout << x; with something similar like vector<X> v; v.push_back(x); * My system is upgraded from Redhat 7.3, but the same resutls were also reproduced with clean Redhat 8 install.
Could you send me some more information? I need to know exactly the steps you are doing in gdb, and the initial banner that gets printed at gdb startup. You can just cut and paste the session. Is this stock gdb from 8.0? thanks
Created attachment 84785 [details] A transcript of gdb session & related.
OK, I've attached a transcipt of the session now. GDB starts leaking on info args See attachment - it is the output of "script" command.
Just wanted to note that I was having an identical problem. I upgraded my gdb-5.2.1 package which came stock with RH8.0 to gdb-5.3post-0.20021129.3 (rawhide package) and my problem was solved.
I retested this with the latest gdb: 5.3.90-0.20030710.16. The problem is gone.