Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sometimes I'll have a loop that I accidentally made too big. I'll evaluate, and MM will try to run through the entire loop. The program itself doesn't actually seem frozen... I can go to Evaluation-> Abort/Interrupt evaluation, but they don't do anything. I can even save while it's doing this!

What seems to kind of work is saving, closing the file, and then going to Evaluation->Quit kernel.

But that's a little ridiculous. Is there really no 'hard kill'?

Thank you!

share|improve this question
    
If the spin is "tight", it can take some time before MM responds to a kill, if at all. Try putting TimeConstrained around your test cases or put in some explicit guard until you're sure they are peachy. –  rasher Feb 25 at 5:59
    
Okay, but I'm curious: what's the logic behind designing it like this? I'd understand if it wanted to give literally all its resources to computing the code, but it's clearly checking for things like mouse clicks, menu openings, saving, etc. So why not just have something that really kills it? –  YungHummmma Feb 25 at 6:30
    
Sometimes it works to repeatedly abort the evaluation (on my mac with shortcut cmd+.), it has happened to me before that I was able to kill the evaluation only after hitting the abort shortcut 8 times or so. Maybe it's a matter of killing sub processes individually? –  freddieknets Feb 25 at 7:46
    
On Windows you can still kill MathKernel.exe in the task manager, it always works :D –  Öskå Feb 25 at 10:32
    
@YungHummmma As you noticed, usually you can kill the kernel instantly by Evaluation -> Quit. But then you lose all kernel state (definitions made so far, etc.) Interrupting an evaluation while maintaining a clean kernel state is not an easy task at all. If you extend Mathematica through C you need to explicitly make your C functions interruptable, i.e. periodically check for an abort and exit from the function in a clean way, ... –  Szabolcs Feb 25 at 12:37
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.