Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16542

Re: Memory leaks problem

From Richard Fateman <fateman@cs.berkeley.edu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Memory leaks problem
Date 2014-02-09 09:40 +0000
Message-ID <ld7if6$e5i$1@smc.vnet.net> (permalink)
References <20140205082549.5383569ED@smc.vnet.net> <ld4rdc$767$1@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


On 2/8/2014 12:55 AM, Peter Klamser wrote:
> ... I think, Mathematica has lazy evaluation built in. Therefore it
> is useless to measure memory in use, because the system looks for
> free memory in ram an decides on this its strategy of storing
> results.
>
> Kind geragds from Peter

Can you point to any documentation from which you derived this 
understanding?

Mathematica does not do "lazy evaluation" though I suppose you can
delay evaluation via Hold[] and friends.
Nor does it "look for free memory"  (which I think is your way of saying
garbage collection). It uses what other people call reference counts,
a technique usually considered inferior to garbage collection. The 
documentation on "Memory Management"  does not tell you that the
technique is called reference counting.  Implemented poorly, this
technique (or for that matter, other memory management methods) is a 
source of many bugs which tend to be difficult to isolate. Perhaps
like this one.  Or maybe this is not a bug but a feature, since
Mathematica apparently "caches" some results from Integrate.

Mathematica appears to be rather inefficient in terms of memory...
MemoryInUse[]
MemoryInUse[]
%-%%
shows that some 55,000 bytes are used to store one trivial command.
To cache an integration result, from the data shown,
  it looks like 200k bytes is used each time.  That can add up.
RJF



>
>
> 2014-02-07 14:07 GMT+01:00 <bar@robox.ii.up.krakow.pl>:
>
>> Unfortunately, this is not an option,
>>
>> In my problem i have to use function
>>
>> IF[z_]:=NIntegrate[F[p],{p,0,z}];
>>
>> and parameter "z" depends on pointer of loop (wsk)
>>
>> I tried to use ClearSystemCache[] and no effects too,
>>
>> In my real calculation it is a big problem: mem:17243496
>> mem:24692800 mem:47696432
>>
>> Temporary solution is to calculate only one loop, then Exit[] and
>> run again and so on, But is not comfortable solution
>>
>> regards, Olaf
>>
>>
>>
>>
>> Sseziwa Mukasa <mukasa@gmail.com> wrote:
>>>
>>> Looks like Integrate stores information on each call, compare to
>>> these results:
>>>
>>> ClearAll["`*"]; $HistoryLength = 0; n = 5; integral =
>>> Integrate[Sin[p], {p, 0, 3}]; Do[bound = Table[{wsk, integral},
>>> {wsk, 1, 100}]; ClearAll[bound]; Print[MemoryInUse[]], {st, 1,
>>> n}];
>>>
>>> 46966216
>>
>>
>
>

Back to comp.soft-sys.math.mathematica | Previous | NextPrevious in thread | Find similar


Thread

Re: Memory leaks problem Peter Klamser <klamser@gmail.com> - 2014-02-08 08:55 +0000
  Re: Memory leaks problem <bar@robox.ii.up.krakow.pl> - 2014-02-09 09:38 +0000
  Re: Memory leaks problem Richard Fateman <fateman@cs.berkeley.edu> - 2014-02-09 09:40 +0000

csiph-web