c++ new bad_alloc

try
{
  for (int i = 0; i<1000; i++)
  {
    test1 = new Test();
    cout << i << " new dog success..." << endl;
  }
}
catch (bad_alloc err)
{
  cout << "fail:"<<err.what()<< endl;
}

原文地址:https://www.cnblogs.com/herd/p/10991427.html