MathGroup Archive 2002

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

Search the Archive

Memory Leak with KSubsets?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38275] Memory Leak with KSubsets?
  • From: "Arny" <someone at somewhere.sometime>
  • Date: Tue, 10 Dec 2002 04:17:20 -0500 (EST)
  • Organization: University of California, Riverside
  • Sender: owner-wri-mathgroup at wolfram.com

Dearest group

Has anyone noticed this before?  I would like to use KSubsets and
RandomKSubsets a few million times in a proggy, but after executing it a few
thousand times Mathematica crashes, running out of memory.  Watching my Taskman (Win
2K, Mathematica 4.1) we see a constant increase in memory used, until its all soaked
up.  I have this problem with both the Combinatorica.m that shipped with
Mathematica, and the new one that has been written, which I believe is now the one
in Mathematica 4.2.  I am not really sure what it means to 'leak memory', but this
seems to fit the bill.

Here is a crashing-demo.  Executing "memorySwallower[3,100]", for example,
repeatedly just soaks up more and more memory.  Pourquoi?  I believe the
same thing happens if I use KSubsets also.

In[1]:=
MemoryInUse[]
Get["DiscreteMath`Combinatorica`"]
MemoryInUse[]
Out[1]=
1398624
Out[3]=
1956536

memorySwallower[S_,n_]:=
  Module[{data,subsamples},Print[ToString[MemoryInUse[]]];
    Table[data=Table[{i,j},{i,1000},{j,1+m}];
      subsamples=Table[RandomKSubset[data,S],{100}],{m,n}];
    Print[ToString[MemoryInUse[]]]]


memorySwallower[3,100]

15497936
29833672

Regards,
B
_____________________________
  Bernard Gress
  Department of Economics
  University of California, Riverside
  1150 University Ave.
  Riverside, CA 92521-0247
  Fax: (909) 787-5685
  Phone: (909) 778 9813
  BGRESSatMAILdotUCRdotEDU
  ICQ: 9083461
  http://www.economics.ucr.edu/people/candidates.html








  • Prev by Date: MultipleListPlot not working
  • Next by Date: Re: Re: 1^Infinity
  • Previous by thread: Re: MultipleListPlot not working
  • Next by thread: Re: Memory Leak with KSubsets?