How detect infinite loop in Java? -
i run java program, , doesn't ends in long time. guess may infinite loop in code, can't see code(can't modify it).
how judge it's in infinite loop or not?
it's interview question , answer judge pc(program counter) in loop or not. interviewer give me hint use stack , heap of program
...
in theory, can't. that's halting problem.
in practice, can check cycles in call stack. java should crash once runs out of memory , dump stack trace. tedious, maybe potentially useful.
Comments
Post a Comment