MathGroup Archive 1997

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

Search the Archive

Memory Leaks In Matrix Summation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg5822] Memory Leaks In Matrix Summation
  • From: rmj at leland.Stanford.EDU (Roger M. Jones)
  • Date: Wed, 22 Jan 1997 00:44:21 -0500
  • Organization: Stanford University, CA 94305, USA
  • Sender: owner-wri-mathgroup at wolfram.com

In summing a matrix I write over previous values
in a do loop.  However, as the resulting sample
shows, the memory continues to grow (as it is in a loop
it should, of course, write over itself).  Is this
a bug, and if so is there some means of avoiding it?


In[1]:=
xx=Array[Random[]+I Random[],{41,206}];

In[2]:=
(* 206 x 206 Matrix of zeros *)
res0=Table[0,{i,1,206},{j,1,206}];

In[3]:=
(* Generate Matrix 206 x 206 ten times & sum over loop *)
Do[

xxk=xx[[k]];
Print["#: ",k];
res=Re[Outer[Times,Conjugate[#],#]&[xxk]];
res0=res0+res;
Print["Mem: ",N[MaxMemoryUsed[]/10^6]],

{k,1,10}]

#: 1
Mem: 10.9363
#: 2
Mem: 13.3135
#: 3
Mem: 14.332
#: 4
Mem: 15.5276
#: 5
Mem: 17.7384
#: 6
Mem: 19.9492
#: 7
Mem: 22.16
#: 8
Mem: 24.3708
#: 9
Mem: 26.5816
#: 10
Mem: 28.7924


Many thanks,

Roger Jones




-- 
Regards,

Roger Jones

(rmj at leland.stanford.edu)


  • Prev by Date: running a remote kernel under NT 4.0?
  • Next by Date: extracting elements from a list of lists
  • Previous by thread: running a remote kernel under NT 4.0?
  • Next by thread: Re: Memory Leaks In Matrix Summation