Re: Memory leaks problem

*To*: mathgroup at smc.vnet.net*Subject*: [mg132306] Re: Memory leaks problem*From*: Sseziwa Mukasa <mukasa at gmail.com>*Date*: Thu, 6 Feb 2014 03:45:16 -0500 (EST)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Delivered-to*: l-mathgroup@wolfram.com*Delivered-to*: mathgroup-outx@smc.vnet.net*Delivered-to*: mathgroup-newsendx@smc.vnet.net*References*: <20140205082549.5383569ED@smc.vnet.net>

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 46966216 46966216 46966216 46966216 So if you can do the integral unbounded before your Do loop you can just use the expression in the loop and avoid the memory overhead. Regards, Sseziwa On Wed, Feb 5, 2014 at 3:25 AM, <bar at robox.ii.up.krakow.pl> wrote: > Hello, > > I have a problem : memory disappears (leaks) during calculation, > > code: > =============================== > ClearAll["`*"]; > $HistoryLength = 0 > n = 5; > Do[bound = Table[{wsk, Integrate[Sin[p], {p, 0, 3}]}, {wsk, 1, 100}]; > ClearAll[bound]; > Print[MemoryInUse[]] > ,{st, 1, n}]; > ================================= > output: > ---------------------------------- > 24971664 > > 25168576 > > 25365240 > > 25593976 > > 25789224 > ---------------------------------- > > When I used simple calling function ( Sin[] instead of Integrate[Sin[]] > this effect didn't occure. > I tried $HistoryLength = 0, ClearAll[bound] and also with no effects > > In my real calculation I used more complicated function . I tried to obtain > tables of numerical intergrated functions and I was saving it step by step > to the file. > > After many steps my all memory leaked and server crashed ( 48 GB RAM) > The table "bound" contained only 50 numerical results of integration per > one step > > (system Linux Scietific , Fedora, Ubuntu) > > > Have you any ideas ? > > With Best Regards, Olaf > > >

**References**:**Memory leaks problem***From:*<bar@robox.ii.up.krakow.pl>