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

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -