MathGroup Archive 2005

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

Search the Archive

Shuffling 10^8 numbers: memory problems

  • To: mathgroup at
  • Subject: [mg53295] Shuffling 10^8 numbers: memory problems
  • From: George Szpiro <george at>
  • Date: Tue, 4 Jan 2005 03:14:23 -0500 (EST)
  • Sender: owner-wri-mathgroup at

The  problem of quadratic time seems to have been solved by using

aa = Developer`ToPackedArray[aa];

after reading in the data.

But now the Mathematica kernel hits the limit again at 2*10^7 data: it shuts down
MemoryInUse[] shows about 82 MB were used, but my machine has 704MB RAM 
installed! What is happening?

Is there a way to work around that one? I need to shuffle five times as
many integer numbers, i.e., I would need about 420 MB memory.

Would it maybe help to start my machine in Safe Mode, so that no other
processes run, and thus get the use of nearly the full 704 MB memory?
(By the way, the 10^8 numbers are integers that are not larger than
about 1000 or 5000.)


The program I used:

SSS=20000000;   (*I need to use 100000000*)

aa = Developer`ToPackedArray[aa];

SetAttributes[shuffleSet, HoldFirst];
shuffleSet[LL_] := Module[{n=SSS, rand},
        rand = Random[Integer, {j,n}];
        LL[[{j,rand}]] = LL[[{rand,j}]],




  • Prev by Date: Spherical density visualization
  • Next by Date: Re: Strange bug
  • Previous by thread: Re: Spherical density visualization
  • Next by thread: Re: Shuffling 10^8 numbers: memory problems