Error Messages/40938

< Error Messages
Revision as of 22:44, 13 January 2010 by Lchrisman (talk | contribs) (Created page with '= Example Error Message = :Stack overflow. This condition occurs when pending evaluations of variables or functions get nested too deeply. The most common cause is a recursive…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Example Error Message

Stack overflow. This condition occurs when pending evaluations of variables or functions get nested too deeply. The most common cause is a recursive user-defined function with an infinite, or excessively deep, recursion.
Call stack:
  Do_srch
  Do_srch
  Do_srch
  ... (8656 function calls not shown)
  Do_srch
  Do_srch
  Srch_on_v
  Va1

Cause

As the message suggests, you probably have a recursive User-Defined Function (a UDF that calls itself), with no termination condition ever satisfied. For example, the error occurred in this recursive function:

Function Do_srch(v : atom handle ; L : list handle ) 
Definition:  
  Var n := Size(L,listLen:true);
  If n>0 Then (
    MetaVar f1 := Slice(L,1);
    MetaVar rest := Slice(L,Sequence(2,n,strict:true));
    WhatIf( Do_srch(v,L), f1, fixVal[theVar=f1] )
   ) Else ...


In this case, there was a bug in Do_srch(v,L), which should have been Do_srch(v,rest). The bug caused the recursive function to call itself with the same parameters each time.

Comments


You are not allowed to post comments.