MathGroup Archive 2008

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

Search the Archive

Re: Out of memory.

  • To: mathgroup at
  • Subject: [mg89271] Re: Out of memory.
  • From: David Bailey <dave at>
  • Date: Tue, 3 Jun 2008 03:59:11 -0400 (EDT)
  • References: <g1tjji$kh9$> <> <g20b4e$g0l$>

Richard Bowles wrote:
> Thanks Daniel and David for taking the time to reply.
> I have added a more complete sample of the code, with a simplified  
> version of the matrix (10x10),  that takes the 4th power of the  
> matrix. This runs in a few mins. It will produce a couple of 1/0  
> division errors, but these disappear with increasing matrix size.
> A couple of additional points might also be of help.
> 1. The matrix is algebraic, so I was expecting memory problems with  
> the MatrixPower operation, but this is actually completed for the full  
> problem. The out of memory occurs once it has entered the loop for  
> extracting the coefficients and exponents. The error occurs after a  
> number of cycles has been completed. I plotted out MemoryInUse[] as a  
> function of the number of inner loop cycles and see a linear increase  
> in the memory consumed with one large jump in memory use part way  
> through. This suggest me that it might be possible to release the  
> memory consumed at each step but I have been unable to figure out how.  
> However, there is an Expand[] operation in the loop over all the  
> elements of the matrix, and this polynomial becomes extremely large  
> with increasing power and it might be this point that ultimately does  
> me in rather than the incremental memory consumption of the inner loop.
> 2. The configuration of the machine is correct, but I dont know how  
> much of this memory Mathematica has access to.
> cheers
> Richard
Your code runs in a few seconds (probably mainly notebook I/O time) on 
my machine - so I think there is something different compared with your 
machine. My machine is 32-bit, 2GHz, with 1G of main memory! If I print 
out MemoryInUse[] in the inner loop, it never rises above ~10 MB!

BTW, your output streams were a bit tangled up.

My guess is one of the following:

1)   There is a missing assignment to some variable which makes the 
algebraic expressions on your side much larger.

2)    You auto-execute some other code that accidentally gives a value 
to something before the code starts to work.

NB: You can apply ByteCount to expressions to see how expensive they are.

David Bailey

  • Prev by Date: Re: Re: Default magnification for Help and Tutorials?
  • Next by Date: How to introduce a Functional with the results with Solve command?
  • Previous by thread: Re: Re: Out of memory.
  • Next by thread: Re: Mathematica 6: No more memory available problem with ListDensityPlot