# MUMPS, solve and possible memory leaks

**URL:** <https://community.freefem.org/t/mumps-solve-and-possible-memory-leaks/168>\
**Category:** General Discussion\
**Created:** [November 5, 2019, 5:39pm UTC](https://community.freefem.org/t/mumps-solve-and-possible-memory-leaks/168 "2019-11-05T17:39:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander1](https://avatars.discourse-cdn.com/v4/letter/a/34f0e0/32.png) [@Alexander1](https://community.freefem.org/u/Alexander1)\
**Post date:** [November 5, 2019, 5:39pm UTC](https://community.freefem.org/t/mumps-solve-and-possible-memory-leaks/168/1 "2019-11-05T17:39:29Z")

</div>

Dear all,

I am trying to parallelize a solution of a nonlinear time-dependent problem using FreeFEM++ 4.2.1 with the MUMPS package. At every time step I use “solve” in this way

load “MUMPS”  
…  
for (int m = 0; m\<mmax; m++){  
f=u1old^2+u2old^2;  
solve PDE([u1,u2], [v1,v2], solver=sparsesolver,master=-1)=  
int3d(th,mpirank)(u1 \* v1/dt + u2 \* v2/dt - u1old \* v1/dt - u2old \* v2/dt +f \* u1 \* v1+…)  
…;  
u1old=u1;  
u2old=u2;  
}

It works fine in the sense that the results are the same as for a non-parallel solver and there is a reasonable speed-up, but I have encountered memory leaks - something stays in the memory and after several loops, my laptop runs out of memory.

I think I use “solve” in the wrong way and the matrix or the solution stays in the memory. Is it so? Could you point out please, where I can find out about the _master_ parameter?

I have tried to use “problem” in the same way and the results are the same (in the sense both the precision and memory leaks).

Thank you!

---

<div class="post-metadata">

**Author:** ![xlzheng](https://avatars.discourse-cdn.com/v4/letter/x/2acd7d/32.png) [@xlzheng](https://community.freefem.org/u/xlzheng)\
**Post date:** [June 29, 2020, 8:39am UTC](https://community.freefem.org/t/mumps-solve-and-possible-memory-leaks/168/2 "2020-06-29T08:39:27Z")

</div>

hi,  
Have you solved the memory leak problem？ I meet the same trouble when I parallelize a linear problem with MUMPS package, and don’t know how to solve. If you have solved the problem, could you give me some advices what should I do .If you haven’t , maybe we could discuss together.

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [June 29, 2020, 9:11am UTC](https://community.freefem.org/t/mumps-solve-and-possible-memory-leaks/168/3 "2020-06-29T09:11:17Z")

</div>

You can solve this problem by using the PETSc interface to MUMPS. See [this](https://community.freefem.org/t/install-parms-library-of-parallel-solvers/480/4) post, replace `-pc_type hypre` by `-pc_type lu` (though for simple problems such as heat equations and such, you should definitely use _hypre_ and not MUMPS).
