计算中断,提示"已杀死"是什么原因?
-
我在昨天发现了这个错误,怀疑也是内存出的问题。仔细回想了一下,昨天在程序里面写了几行:
scalar* zeta = new double [2*n];
后面忘了删除。昨晚上计算的时候三个算例全部
killed
:diagonal: Solving for M11, Initial residual = 0, Final residual = 0, No Iterations 0 diagonal: Solving for M12, Initial residual = 0, Final residual = 0, No Iterations 0 diagonal: Solving for M13, Initial residual = 0, Final residual = 0, No Iterations 0 diagonal: Solving for M14, Initial residual = 0, Final residual = 0, No Iterations 0 PIMPLE: iteration 1 GAMG: Solving for p, Initial residual = 0.0004130904583986163, Final residual = 2.405751520795531e-06, No Iterations 4 time step continuity errors : sum local = 8.330982304837603e-10, global = 1.267524541545882e-12, cumulative = -2.029919160042075e-06 Killed
无任何消息。然后我在源代码中将这个
new
出来的数组delete
之后,就不会出错了。另外,我测试了一下,不删除数组计算的时候内存会一直上升。因此,动态数组记得释放!