# Malloc() error on Ubuntu

**URL:** https://community.freefem.org/t/malloc-error-on-ubuntu/634
**Category:** General Discussion
**Created:** [November 4, 2020, 10:13am UTC](https://community.freefem.org/t/malloc-error-on-ubuntu/634 "2020-11-04T10:13:58Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Lily](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@Lily](https://community.freefem.org/u/Lily)
#### Post date: [November 4, 2020, 10:13am UTC](https://community.freefem.org/t/malloc-error-on-ubuntu/634/1 "2020-11-04T10:13:58Z")

</div>

Hello,  
I’m using FreeFem on Ubuntu 20.04 and I have a strange issue.  
I simply want to glue two meshes with the command “Th = Th1 + Th2”.  
It returns the error  
“malloc(): invalid size (unsorted)  
Abandon (core dumped)”  
I don’t understand why. The very same code runs properly on my Windows machine, so I guess it’s an Ubuntu issue…  
Can anyone help me?!  
Thanks a lot.  
Lily

---

<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: [November 4, 2020, 1:29pm UTC](https://community.freefem.org/t/malloc-error-on-ubuntu/634/2 "2020-11-04T13:29:41Z")

</div>

Hello Lily,  
Could you please share your code?  
Thanks.

---

<div class="post-metadata">

### Author: ![Lily](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@Lily](https://community.freefem.org/u/Lily)
#### Post date: [November 4, 2020, 1:55pm UTC](https://community.freefem.org/t/malloc-error-on-ubuntu/634/3 "2020-11-04T13:55:39Z")

</div>

Hello prj,

I have extracted the simplest code :  
load “msh3”

mesh3 Th, Th1, Th2;

Th1 = readmesh3(“mesh1.mesh”);  
Th2 = readmesh3(“mesh2.mesh”);

Th = Th1 + Th2;  
savemesh(Th,“finalmesh.mesh”);

The meshes “mesh1.mesh” and “mesh2.mesh” were created with GMSH, then remeshed with MMG3D. They have respectively 30246 and 33342 tetrahedral elements.  
Even with the simplest code above, I get the malloc error on Ubuntu and not on Windows. Otherwise, all my code run correctly on Ubuntu.

Thank you.

---

<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: [November 4, 2020, 1:57pm UTC](https://community.freefem.org/t/malloc-error-on-ubuntu/634/4 "2020-11-04T13:57:47Z")

</div>

We need those meshes. Are they conforming?

---

<div class="post-metadata">

### Author: ![Lily](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@Lily](https://community.freefem.org/u/Lily)
#### Post date: [November 4, 2020, 2:48pm UTC](https://community.freefem.org/t/malloc-error-on-ubuntu/634/5 "2020-11-04T14:48:43Z")

</div>

Yes, they are conforming.

---

<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: [November 4, 2020, 3:35pm UTC](https://community.freefem.org/t/malloc-error-on-ubuntu/634/6 "2020-11-04T15:35:18Z")

</div>

Upload them somewhere so we can reproduce the error, please.

---

<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: [November 4, 2020, 8:12pm UTC](https://community.freefem.org/t/malloc-error-on-ubuntu/634/8 "2020-11-04T20:12:21Z")

</div>

What is your FreeFEM version?

---

<div class="post-metadata">

### Author: ![Lily](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@Lily](https://community.freefem.org/u/Lily)
#### Post date: [November 5, 2020, 7:14am UTC](https://community.freefem.org/t/malloc-error-on-ubuntu/634/9 "2020-11-05T07:14:47Z")

</div>

I’m using FreeFem++ 4.1

---

<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: [November 5, 2020, 7:28am UTC](https://community.freefem.org/t/malloc-error-on-ubuntu/634/10 "2020-11-05T07:28:49Z")

</div>

Please update to the latest version, 4.7-1, there is no error there.

---

<div class="post-metadata">

### Author: ![Lily](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@Lily](https://community.freefem.org/u/Lily)
#### Post date: [November 5, 2020, 8:02am UTC](https://community.freefem.org/t/malloc-error-on-ubuntu/634/11 "2020-11-05T08:02:26Z")

</div>

Ok, I will. Is there a way to have both versions on the same machine, or do I have to uninstall the version 4.1 and then install the version 4.7-1?

---

<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: [November 5, 2020, 8:11am UTC](https://community.freefem.org/t/malloc-error-on-ubuntu/634/12 "2020-11-05T08:11:56Z")

</div>

If you compile FreeFEM from sources, you can have two installations. Otherwise, I’m not sure.

---

<div class="post-metadata">

### Author: ![Lily](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@Lily](https://community.freefem.org/u/Lily)
#### Post date: [November 5, 2020, 10:13am UTC](https://community.freefem.org/t/malloc-error-on-ubuntu/634/13 "2020-11-05T10:13:23Z")

</div>

There is no error with the version 4.7-1.  
Thank you!
