Re: Recursion limit: a good idea to ignore?
- To: mathgroup at smc.vnet.net
- Subject: [mg82301] Re: Recursion limit: a good idea to ignore?
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Wed, 17 Oct 2007 04:01:40 -0400 (EDT)
- References: <email@example.com> <firstname.lastname@example.org>
Jon Harrop wrote: > In:= f := 0 > > In:= f[n_] := 1+f[n-1] > In:= $RecursionLimit=Infinity > > Out= Infinity > In:= f > Segmentation fault > > So recursing too deep (applying your function to a large problem) can cause > the whole Mathematica kernel to die when it overruns the system stack. [...] > $ ocamlnat > Objective Caml version 3.10.0 - native toplevel > > # let rec f = function > | 0 -> 0 > | n -> 1 + f(n - 1);; > val f : int -> int = <fun> > # f 1000000;; > Stack overflow during evaluation (looping recursion?). > # > Note that OCaml [...] failed with a nice > catchable exception. I wish Mathematica did that too instead of crashing and causing one to lose all data stored in the Kernel. -- Szabolcs