“std::bad_alloc”: am I using too much memory?

前端 未结 3 1139
囚心锁ツ
囚心锁ツ 2020-12-10 01:42

The message:

terminate called after throwing an instance of \'std::bad_alloc\'
what():  std::bad_alloc

I looked at the gdb backtrace and

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-10 02:00

    I got this error trying to allocate a negative length array:

    double myArray = new double[-9000];

    Just in case it helps anyone.

提交回复
热议问题