# Running out of memory using FindMinimum with ParametricFunctions

I am running a pretty large optimization problem which actually consists of an outer an inner optmization problem. I use ParametricNDSolve for solving a ODE system. When the optimization is done, Mathematica uses almost all of my RAM memory. If I try Remove["Global*"] the memory used is still the same.

Is there an easy way to check where the RAM in used?

-
Does setting $HistoryLength=0` help? – user21 Jun 6 '13 at 10:57 What happens when you quit the kernel? – Sjoerd C. de Vries Jun 6 '13 at 11:47$HistoryLength=0 does not solve the issue..When I quiet the kernel the RAM used is decreased to the amount that is used when Mathematica is started. –  jaclea Jun 9 '13 at 11:57

I used to have the same problem.

It would've helped if you had posted your code here. Anyways I had the same problem and I completely solved it by changing the method. try all of these methods see which one suits your problem more

• TimeIntegration
• BoundaryValues
• DiscontinuityProcessing
• EquationSimplification
• IndexReduction
• DAEInitialization
• PDEDiscretization

Hope it will solve your problem.

-
The problems is pretty large, but I will try to create a small example to illustrate the problem.. I will take a deeper look at the methods you mentioned and see if it helps! –  jaclea Jun 9 '13 at 11:57
I haven't found any solution to the problem above. Is anyone aware of problems with NDSolve and memory management? I call NDSolve inside a Module which is called several times during the optimization. When the optimization is done a large amount of memory has disappeared somewhere. It's not in the global context since I dont free up the memory when Removing the global context. –  jaclea Feb 28 at 11:40