Re: Kernel exits (for lack of memory)

*To*: mathgroup at smc.vnet.net*Subject*: [mg128137] Re: Kernel exits (for lack of memory)*From*: Joseph Gwinn <joegwinn at comcast.net>*Date*: Tue, 18 Sep 2012 03:41:59 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Delivered-to*: l-mathgroup@wolfram.com*Delivered-to*: mathgroup-newout@smc.vnet.net*Delivered-to*: mathgroup-newsend@smc.vnet.net*References*: <k2s2re$dq5$1@smc.vnet.net> <k368j5$1ud$1@smc.vnet.net>

In article <k368j5$1ud$1 at smc.vnet.net>, dgolber at aol.com wrote: > I am already storing partial results, which lets me make progress on this > problem. > > In looking at MemoryInUse, I found the following interesting behavior: > > Mathematica 4 running directly on Windows XP. > > The notebook below fits a 2-parameter curve (a simple Bezier curve) to some > data. > > The module "error" finds the total sum-of-squares of distances from the data > points to a curve. The main cell (not a module) uses FindMinimum to vary the > curve parameters to minimize the error. > > The "error" module prints MemoryInUse each time it is entered. > > The main cell is run twice (two completely distinct copies). The first time > it is run, we see MemoryInUse building up from about one MB to 25 MB, as (I > assume) FindMinimum builds up its search context. > > The second time it is called, MemoryInUse starts aleady at 25 MB! In other > words, even though the (first) use of FindMinimum is completely over, the > memory it used is still shown in MemoryInUse. > > What is going on? The Out[] variables are storing all results, just in case you ask for them. Set $HistoryLength to zero to turn this off. One can also Clear[] intermediate variables to reduce memory footprint. Joe Gwinn