600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > 报错信息 terminate called after throwing an instance of ‘std::cad_alloc‘ what():std::bad_alloc

报错信息 terminate called after throwing an instance of ‘std::cad_alloc‘ what():std::bad_alloc

时间:2024-01-19 14:08:59

相关推荐

报错信息 terminate called after throwing an instance of ‘std::cad_alloc‘ what():std::bad_alloc

最近做了一道bfs算法的程序题

输入测试数据后卡在运行框中 然后会产生一个错误信息

第一次见到这样的报错于是记录一下解决过程

terminate called after throwing an instance of 'std::bad_alloc’

百度上说是数据量太大 导致内存爆掉

仔细检查代码后发现bfs()函数中数据的重复处理导致相同的数据重复进入队列 处理量过大从而内存爆掉

加上这句 data[next.x][next.y]=’#’;

加上处理完成标志 避免重复处理 即可解决这个问题

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。