Deal with the error "terminate called after throwing an instance of 'std::bad_alloc'"

来源:互联网 发布:郝斌c语言怎么样 编辑:程序博客网 时间:2024/05/16 15:26

This error in C++ is probably due to the memory leak, like using malloc() but forget to free it.


For a loop, it usually works well when the loop is short; but when it is long, sometimes the problem comes due to lack of memory space.