Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1992
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1992

[Date Index] [Thread Index] [Author Index]

Search the Archive

Stack overflow/Mathematica

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: Stack overflow/Mathematica
  • From: Scott Perkins <perkins at acs00.cc.vanderbilt.edu>
  • Date: Fri, 8 May 92 11:30:24 CDT

>Date: Wed, 6 May 1992 09:52:07 -0500
>From: "Theodore W. Gray" <guam!me at wri.com>
>To: perkins at acs00.cc.vanderbilt.edu
>Subject: Stack overflow

I don't know if you've gotten the response that I sent to Steve
Christensen about stack overflow problems, but in case you don't
I'll tell you directly.....

You can set the stack size used by Mathematica: The Startup
Preferences dialog (Preferences submenu in Edit menu) has a field
where you can type in any stack size you like (the default is 512K).
The new size takes effect when you restart Mathematica.

The current scheme Mathematica uses to try to avoid stack overflow
errors is the variable $RecursionLimit, by default 256.  Evaluation
will halt if recursion exceedes this depth.  This is not a perfect
scheme, because it assumes that the average stack frame is less than
2K, which is almost, but not always, true.  Also, there are some
cases where a function is internally recursive without incrementing
the recursion depth counter.

We have considered putting in an explicit check of stack usage 

in front of each recursive call, but there are serious problems with
this.  For one thing, it would slow everything down, particularly
some things that you really want to be fast.

For now, if you do have a crash caused by stack overflow, you can
solve it by increasing the stack size.  However, this is very rarely
the actual cause of the trouble, since $RecursionLimit almost always
protects you.

I don't follow the netnews, so I don't know what's been said about
Mathematica and System 7, but I can say the following things.  There
were two unrelated bugs, one in V2.0.3 (fixed in 2.0.4) and one in
recent 2.1 beta versions (you mention being a beta site) which would
cause crashes particularly under System 7.  The first during 

rendering of 8-bit color graphics, and the other while switching back
and forth repeatedly between applications.  These have both been
fixed, and neither exists in the currently shipping version.

As for things Apple could or could not do to improve performance, 

there are a lot.  For one thing, the virtual memory swapping speed in
System 7 is very slow.  For another, having to decide ahead of time
how much memory to allow Mathematica to ever use tends to cause
people to allot less memory that is going to be needed.  If 

Mathematica could grow its partition as needed, you would be much
less likely to run out of memory.  Not that this excuses crashing on
out of memory condition, which should never happen, but still it
would make you much more likely to get an answer.  (Even if we were
all perfect superhumans, Mathematica would still not be able to give
a correct answer without enough memory.)

You are welcome to forward this to the newsgroup if you like: As I
said I don't follow netnews, but someone from WRI will end up
posting something similar.

Theo





  • Prev by Date: Technical Writer wanted
  • Next by Date: how to label contour levels??
  • Previous by thread: Technical Writer wanted
  • Next by thread: how to label contour levels??