Just to add that when I replace the line :

            List * ptrList2 = new  List();


in ideone.com.YN6we4.cpp with :

            List * ptrList2 = new (nothrow) List();
            if (!ptrList2) {
                        cout << "out of memory - created " << var << " nodes" << endl;
                        break;
             }

I get :

C:\Users\MrD\Desktop\mingw bug>g++ ideone.com.YN6we4.cpp

C:\Users\MrD\Desktop\mingw bug>a.exe
size of List c++ : 16
out of memory - created 87929614 nodes

C:\Users\MrD\Desktop\mingw bug>

I have 6 GB of RAM, on a i7 950, Windows x64 7 Pro

So why is this happening?


View this message in context: Re: unable to catch bad_alloc
Sent from the MinGW-users mailing list archive at Nabble.com.