Re: cant free ram..
- To: mathgroup at smc.vnet.net
- Subject: [mg109280] Re: cant free ram..
- From: Zach Bjornson <bjornson at mit.edu>
- Date: Tue, 20 Apr 2010 05:51:28 -0400 (EDT)
Unfortunately there's no way to get the kernel to deallocate memory. I've asked for this functionality to be included in the next version, but I don't think it has. If you use version 7, there's a trick I use: Evaluate your memory-munching loop on one "parallel kernel." results = ParallelEvaluate[(*your do loop*), First@Kernels] At this point the slave kernel will be the one using all the memory, and you can use CloseKernels to free up all of the memory it had allocated. Since this will still use too much memory in one shot, you can enclose the above pair of operations in, say, Table or another loop, and use that outer loop to adjust the inner loop's bounds, making sure that only those three data points per grid point are saved in the outer loop. Setting $HistoryLength = 0 may help some as well, but will not solve your problem. -Zach On 4/19/2010 5:59 AM, ValeX wrote: > i'm running a Do loop over a grid of points, say 100x100. > the problem is that for every grid point the ram used increases by 1.4 > MB and so i cant actually finish the evaluation > [100x100x1.4 is roughly 14GB] > > of all the outputs i need only 3 numbers per grid point and so i tried > the following: > > ClearAll[all the variables i used and i dont need anymore]; > ClearSystemCache; > Unprotect[In, Out]; Clear[In, Out]; Protect[In, Out]; > > but the memory does not go down... > even if i do Remove["Global`*"] nothing happens. > > in the Do loop i do a bunch of things like FindRoot, Interpolation, > NDSolve, NIntegrate, .. > is it that maybe i've got to clear some specific place other than the > history and Global? > >