Re: Garbage collection problem

*To*: mathgroup at smc.vnet.net*Subject*: [mg51977] Re: Garbage collection problem*From*: D Herring <dherring at at.uiuc.dot.edu>*Date*: Sat, 6 Nov 2004 02:07:38 -0500 (EST)*References*: <cm7d0u$lho$1@smc.vnet.net> <cma0s1$8vg$1@smc.vnet.net> <cmcmbs$ics$1@smc.vnet.net> <cmfbvr$7hp$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Hi Sean, You're missing the error. I did too until my computer ran out of memory (512MB gone). > are you monitoring it as the module is running? like by use of task > manager type of program? yep. the "top" and "free" commands on Linux. These give me the same info as the MSWindows "task manager". > try this... .... > In[26]:= > arun[do_]:= Module[{}, Do[ soln=NDSolve[eq,vars,{t,0,2}][[1]];, {do}] > ] > > > In[36]:= > arun[20] > MemoryInUse[] .... > arun[200] > MemoryInUse[] > > Out[37]= > 2999248 .... > Out[41]= > 2998864 This is good. 2998864-2999248 < 0 so memory was actually recovered. > above shows that once you use Module in combination with Share[] ( > twice), the memory usage between runnign the module 20x vs 200x is > relatively miniscule. yep. I agree. > similar with the example b. I disagree. Look again. > In[42]:= > brun[do_]:= Module[{}, Do[ soln=NDSolve[eq,vars,{t,0, > 2},StoppingTest->test][[1]]; , {do}]] > > In[43]:= > brun[20] > MemoryInUse[] .... > brun[200] > MemoryInUse[] > > Out[44]= > 3057560 .... > Out[48]= > 3908176 Now check the memory usage. 3908176-3057560 = 850616 !! That's nearly one more MB used, but no new variables created. On my machine, every time I run brun[20], I lose even more memory - even though no new information is being created. Share[] does not help me. $HistoryLength=0 does not help... Ideas? >>Is this problem related to my version/platform of Mathematica? > > i'm running windoze xp Mathematica 5.0 Thanks again, Daniel