MathGroup Archive 2004

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

Search the Archive

Re: Garbage collection problem


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


  • Prev by Date: Re: Problems about Graphics
  • Next by Date: need help with integration
  • Previous by thread: Re: Garbage collection problem
  • Next by thread: Re: Hypergeometric functions and Sum error in 5.01?