# Memory Leak on MacOS with ff-mpirun

**URL:** https://community.freefem.org/t/memory-leak-on-macos-with-ff-mpirun/3154
**Category:** General Discussion
**Created:** [April 27, 2024, 5:50pm UTC](https://community.freefem.org/t/memory-leak-on-macos-with-ff-mpirun/3154 "2024-04-27T17:50:05Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![LXX](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@LXX](https://community.freefem.org/u/LXX)
#### Post date: [April 27, 2024, 5:50pm UTC](https://community.freefem.org/t/memory-leak-on-macos-with-ff-mpirun/3154/1 "2024-04-27T17:50:05Z")

</div>

Hello, everyone.

Firstly, I install open-mai on MacOS.

```auto
mpirun (Open MPI) 5.0.3

```

For `diffusion-2d.edp` When I use `ff-mpirun -np 4 diffusion-2d.edp`

```auto
 Warning: -- Your set of boundary condition is incompatible with the mesh label.
 Warning: -- Your set of boundary condition is incompatible with the mesh label.
 Warning: -- Your set of boundary condition is incompatible with the mesh label.
 Warning: -- Your set of boundary condition is incompatible with the mesh label.
 Warning: -- Your set of boundary condition is incompatible with the mesh label.
 Warning: -- Your set of boundary condition is incompatible with the mesh label.
 Warning: -- Your set of boundary condition is incompatible with the mesh label.
 Warning: -- Your set of boundary condition is incompatible with the mesh label.
 Warning: -- Your set of boundary condition is incompatible with the mesh label.
times: compile 0.028738s, execution 0.140543s, mpirank:1
 ######## We forget of deleting 1 Nb pointer, 0Bytes , mpirank 1, memory leak =4826064
 CodeAlloc : nb ptr 7502, size :650272 mpirank: 1
times: compile 0.028734s, execution 0.139155s, mpirank:2
 ######## We forget of deleting 1 Nb pointer, 0Bytes , mpirank 2, memory leak =4654432
 CodeAlloc : nb ptr 7502, size :650272 mpirank: 2
times: compile 0.028961s, execution 0.139101s, mpirank:3
 ######## We forget of deleting 1 Nb pointer, 0Bytes , mpirank 3, memory leak =2325024
 CodeAlloc : nb ptr 7502, size :650272 mpirank: 3
times: compile 1.267290e-01s, execution 1.915500e-02s, mpirank:0
 ######## We forget of deleting 1 Nb pointer, 0Bytes , mpirank 0, memory leak =4200688
 CodeAlloc : nb ptr 7502, size :650272 mpirank: 0
Ok: Normal End

```

If I use `mpirun -np 4 FreeFem++-mpi diffusion-2d.edp `

```auto
times: compile 2.360370e-01s, execution 6.631000e-03s, mpirank:0
 ######## We forget of deleting 5 Nb pointer, 0Bytes , mpirank 0, memory leak =76720
 CodeAlloc : nb ptr 7502, size :650272 mpirank: 0
Ok: Normal End
times: compile 2.350180e-01s, execution 6.796000e-03s, mpirank:0
 ######## We forget of deleting 5 Nb pointer, 0Bytes , mpirank 0, memory leak =11184
 CodeAlloc : nb ptr 7502, size :650272 mpirank: 0
Ok: Normal End
times: compile 2.381260e-01s, execution 6.856000e-03s, mpirank:0
 ######## We forget of deleting 5 Nb pointer, 0Bytes , mpirank 0, memory leak =76720
 CodeAlloc : nb ptr 7502, size :650272 mpirank: 0
Ok: Normal End
times: compile 2.382280e-01s, execution 7.626000e-03s, mpirank:0
 ######## We forget of deleting 5 Nb pointer, 0Bytes , mpirank 0, memory leak =1307024
 CodeAlloc : nb ptr 7502, size :650272 mpirank: 0
Ok: Normal End

```

And for other file.edp in `hpddm` even in `examples`, both command `ff-mpirun -np ` and `mpirun -np ` will output the result of

```auto
######## We forget of deleting 0Nb pointer, 0Bytes , mpirank 0, memory leak =......

```

I do not know if I need to solve the memory leak, and how to fix it?  
Another question, on MacOS, with open mpi, do command `ff-mpirun -np ` and `mpirun -np ` output the same or similar results?

---

<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: [April 27, 2024, 7:41pm UTC](https://community.freefem.org/t/memory-leak-on-macos-with-ff-mpirun/3154/2 "2024-04-27T19:41:54Z")

</div>

These are false positives. Run with `-v 0` and you won’t get any such wrong warnings. If you have a single MPI implementation, `ff-mpirun` and `mpirun` should be the same.

---

<div class="post-metadata">

### Author: ![LXX](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@LXX](https://community.freefem.org/u/LXX)
#### Post date: [April 28, 2024, 5:36am UTC](https://community.freefem.org/t/memory-leak-on-macos-with-ff-mpirun/3154/3 "2024-04-28T05:36:37Z")

</div>

I am so sorry, but I do not quite understand what you mean. I am a beginner in PETSc and MPI, so I have a lot of doubts about it.

Could you tell me more about what commands I should type in the terminal to get the correct result and not to have warning and memory leaks?

Thank you very much for your reply!

---

<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: [April 28, 2024, 5:37am UTC](https://community.freefem.org/t/memory-leak-on-macos-with-ff-mpirun/3154/4 "2024-04-28T05:37:11Z")

</div>

`ff-mpirun -np 4 diffusion-2d.edp -v 0`

---

<div class="post-metadata">

### Author: ![LXX](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@LXX](https://community.freefem.org/u/LXX)
#### Post date: [April 28, 2024, 5:52am UTC](https://community.freefem.org/t/memory-leak-on-macos-with-ff-mpirun/3154/5 "2024-04-28T05:52:22Z")

</div>

Yes, I know.

The `-v 0` option is used to set the verbosity level of the program’s output, where `0` indicates that all output is turned off except for error messages. The command has executed successfully.

However, I didn’t see any output or log files.

```auto
wxj@WXJdeMacBook-Air WXJ-git % ff-mpirun -np 4 FreeFem_example/hpddm/diffusion-2d.edp -v 0
'/Applications/FreeFem++.app/Contents/ff-4.14/bin/mpiexec' -np 4 /Applications/FreeFem++.app/Contents/ff-4.14/bin/FreeFem++-mpi -nw 'FreeFem_example/hpddm/diffusion-2d.edp' -v 0

```

---

<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: [April 28, 2024, 6:14am UTC](https://community.freefem.org/t/memory-leak-on-macos-with-ff-mpirun/3154/6 "2024-04-28T06:14:56Z")

</div>

What are you expecting to get? You should use the example `diffusion-2d-PETSc.edp`, it is slightly more verbose.

---

<div class="post-metadata">

### Author: ![LXX](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@LXX](https://community.freefem.org/u/LXX)
#### Post date: [April 28, 2024, 7:02am UTC](https://community.freefem.org/t/memory-leak-on-macos-with-ff-mpirun/3154/7 "2024-04-28T07:02:11Z")

</div>

Yes, I run `diffusion-2d-PETSc.edp` with `ff-mpirun -np 4 diffusion-2d-PETSc.edp -v 0`, there is no memory leak.

Then, for `diffusion-2d.edp` and like this without `petsc`, What is the command that I need?

---

<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: [April 28, 2024, 7:48am UTC](https://community.freefem.org/t/memory-leak-on-macos-with-ff-mpirun/3154/8 "2024-04-28T07:48:42Z")

</div>

You need the same command line parameter.

---

<div class="post-metadata">

### Author: ![LXX](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@LXX](https://community.freefem.org/u/LXX)
#### Post date: [May 8, 2024, 12:16pm UTC](https://community.freefem.org/t/memory-leak-on-macos-with-ff-mpirun/3154/9 "2024-05-08T12:16:57Z")

</div>

OK, I understand. Thank you very much!
