The message:
terminate called after throwing an instance of \'std::bad_alloc\' what(): std::bad_alloc
I looked at the gdb backtrace and
I got this error trying to allocate a negative length array:
double myArray = new double[-9000];
Just in case it helps anyone.