# \*ERROR in u\_calloc: error allocating memory

**URL:** <https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728>\
**Category:** Uncategorized\
**Created:** [July 6, 2023, 7:09am UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728 "2023-07-06T07:09:09Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phonix](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@Phonix](https://calculix.discourse.group/u/Phonix)\
**Post date:** [July 6, 2023, 7:09am UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728/1 "2023-07-06T07:09:09Z")

</div>

When I use calculix to deal with fluid-structure coupling problems, I need to use calculix often. I use \*restart, read to ensure that calculix inherits the previous calculation results. However, after running for a while, calculix failed to generate.frd file: : \*ERROR in u\_calloc: error allocating memory

I am using the ccx\_2.20 version, can anyone see the reason for my error message? How should it be corrected?

The following error message is reported:

* * *

CalculiX Version 2.20, Copyright(C) 1998-2022 Guido Dhondt  
CalculiX comes with ABSOLUTELY NO WARRANTY. This is free  
software, and you are welcome to redistribute it under  
certain conditions, see gpl.htm

* * *

You are using an executable made on Tue Jul 4 16:39:43 CST 2023

\*INFO: restart file yezizz.rin  
has been opened for reading.  
it was created with CalculiX Version 2.20

The numbers below are estimated upper bounds

number of:

nodes: 365457  
elements: 5528  
one-dimensional elements: 0  
two-dimensional elements: 5528  
integration points per element: 9  
degrees of freedom per node: 3  
layers per element: 1

distributed facial loads: 0  
distributed volumetric loads: 0  
concentrated loads: 68760  
single point constraints: 401952  
multiple point constraints: 672202  
terms in all multiple point constraints: 717490345  
tie constraints: 0  
dependent nodes tied by cyclic constraints: 0  
dependent nodes in pre-tension constraints: 0

sets: 4  
terms in all sets: 33452

materials: 1  
constants per material and temperature: 2  
temperature points per material: 1  
plastic data points per material: 0

orientations: 5528  
amplitudes: 2  
data points in all amplitudes: 2  
print requests: 0  
transformations: 0  
property cards: 0

\*ERROR in u\_calloc: error allocating memory  
variable=nodempc, file=ccx\_2.20.c, line=272, num=-2142496261, size=4

---

<div class="post-metadata">

**Author:** ![rsmith](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/rsmith/32/1684_2.png) [@rsmith](https://calculix.discourse.group/u/rsmith)\
**Post date:** [July 15, 2023, 10:44am UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728/2 "2023-07-15T10:44:05Z")

</div>

In the error message, it says we need to look at line 272 of file `ccx_2.20.c`.  
This reads:

> NNEW(nodempc,ITG,3\*memmpc\_);

This wants to allocate a block of memory of type `ITG`, which is `long long`. On 64-bit platforms this will be a 64-bit integer, so 8 bytes.  
It wants to allocate `3*memmpc_` of those.

If you search the source code for the string “terms in all multiple point constraints”, you will find that `memmpc_` equals 717490345.

This means that the system wants to allocate 3_717490345_8 bytes, or 17.2 GB (16.03 GiB)!  
Apparently, you have more terms in your multiple point constraints than you have available memory.

For each multiple point constraint you have on average over a thousand terms. So I guess you have too many `*EQUATION`s.

---

<div class="post-metadata">

**Author:** ![Phonix](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@Phonix](https://calculix.discourse.group/u/Phonix)\
**Post date:** [September 1, 2023, 11:24am UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728/3 "2023-09-01T11:24:12Z")

</div>

So do you know how to solve this problem?

---

<div class="post-metadata">

**Author:** ![Phonix](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@Phonix](https://calculix.discourse.group/u/Phonix)\
**Post date:** [September 1, 2023, 11:24am UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728/4 "2023-09-01T11:24:58Z")

</div>

So do you know how to solve this problem? @rsmith

---

<div class="post-metadata">

**Author:** ![rsmith](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/rsmith/32/1684_2.png) [@rsmith](https://calculix.discourse.group/u/rsmith)\
**Post date:** [September 1, 2023, 11:38am UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728/5 "2023-09-01T11:38:45Z")

</div>

Reduce the number of MPC’s.

---

<div class="post-metadata">

**Author:** ![Phonix](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@Phonix](https://calculix.discourse.group/u/Phonix)\
**Post date:** [September 1, 2023, 11:54am UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728/6 "2023-09-01T11:54:09Z")

</div>

@rsmith  
what‘s meaning of MPC? And how to reduce the number of MPC’s?  
this result was executed by using the \*restart,read.inp file many times (180+ times).So I don’t know how to modify it to reduce the number of mpc’s.

---

<div class="post-metadata">

**Author:** ![rsmith](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/rsmith/32/1684_2.png) [@rsmith](https://calculix.discourse.group/u/rsmith)\
**Post date:** [September 1, 2023, 7:22pm UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728/7 "2023-09-01T19:22:18Z")

</div>

> [@Phonix](#):
>
> what‘s meaning of MPC?

Multiple Point Constraint.

> [@Phonix](#):
>
> And how to reduce the number of MPC’s?

Hard to say without seeing the input.

---

<div class="post-metadata">

**Author:** ![Phonix](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@Phonix](https://calculix.discourse.group/u/Phonix)\
**Post date:** [September 2, 2023, 1:55am UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728/8 "2023-09-02T01:55:32Z")

</div>

@rsmith

@rsmith  
the first inp:  
\*INCLUDE, INPUT=Node.msh  
\*INCLUDE, INPUT=Element.nam  
\*INCLUDE, INPUT=Elset.nam  
\*INCLUDE, INPUT=fixed1.nam  
\*Material, Name=Material  
\*Elastic  
46500000, 0.35  
\*Density  
700  
\*Shell section, Elset=Elall, Material=Material, Offset=0  
0.001  
\*Restart, Write  
\*Step, Nlgeom, Inc=1000  
\*DYNAMIC  
0.001,0.005  
\*Boundary  
fixed1,1,6,0  
\*Cload  
Nall,1,0.0  
Nall,2,0.0  
Nall,3,0.0  
\*Node file  
U  
\*End step

the second inp:  
\*Restart, Read  
\*Step, Nlgeom, Inc=1000  
\*DYNAMIC  
0.001,0.005  
\*Boundary  
fixed1,1,6,0  
\*Cload  
\*INCLUDE, INPUT=force.txt  
\*Node file  
U  
\*End step

The second inp file is repeated many times (about 180 crashes).  
Do you need file information such as node and element? Since the number of nodes is 2800+, and I don’t know how to upload files, could you please give me your email address if necessary?

---

<div class="post-metadata">

**Author:** ![rsmith](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/rsmith/32/1684_2.png) [@rsmith](https://calculix.discourse.group/u/rsmith)\
**Post date:** [September 2, 2023, 8:03pm UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728/9 "2023-09-02T20:03:11Z")

</div>

There is no load on your structure because your \*CLOAD is 0 in all directions. So basically nothing happens.

---

<div class="post-metadata">

**Author:** ![jbr](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@jbr](https://calculix.discourse.group/u/jbr)\
**Post date:** [September 2, 2023, 8:25pm UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728/10 "2023-09-02T20:25:33Z")

</div>

Sure, but that should not be the source of the memory allocation problem. @Phonix, I believe it is best to find a way to share all the files you are using for this simulation and share a link so that someone in the community can look into it. I agree with @rsmith that the problem seems related to the number of MPCs in the model, so we would need to look at that. It seems odd to have 365,457 nodes and only 5528 elements → 365,457 nodes / 5528 elements ~ 66.1 nodes per element? Seems odd.

---

<div class="post-metadata">

**Author:** ![rsmith](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/rsmith/32/1684_2.png) [@rsmith](https://calculix.discourse.group/u/rsmith)\
**Post date:** [September 3, 2023, 7:58am UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728/11 "2023-09-03T07:58:26Z")

</div>

> [@jbr](#):
>
> It seems odd to have 365,457 nodes and only 5528 elements

Yeah, that caught my eye as well. I just didn’t know what to think of it. 🤨 Especially since it’s a shell model.

But it might be as simple as gaps in the node numbering. If that is the case, fixing that would help reduce memory requirements.

Maybe @Phonix can also show a picture of the mesh?

---

<div class="post-metadata">

**Author:** ![Phonix](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@Phonix](https://calculix.discourse.group/u/Phonix)\
**Post date:** [September 4, 2023, 12:44am UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728/12 "2023-09-04T00:44:47Z")

</div>

@rsmith  
\*Cload=0 is just the first.inp file, which only produces the initialized.frd file, the second inp file is useful (because I used \*restart,read), whose \*cload changes every time, forces.txt is generated by other software.

---

<div class="post-metadata">

**Author:** ![Phonix](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@Phonix](https://calculix.discourse.group/u/Phonix)\
**Post date:** [September 4, 2023, 12:46am UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728/13 "2023-09-04T00:46:46Z")

</div>

@jbr  
So how do I share files? Could you please give me a contact information such as your email address, and then I will send the relevant documents to you?

---

<div class="post-metadata">

**Author:** ![Phonix](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@Phonix](https://calculix.discourse.group/u/Phonix)\
**Post date:** [September 4, 2023, 12:51am UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728/14 "2023-09-04T00:51:07Z")

</div>

@rsmith

 ![1693788502526](https://global.discourse-cdn.com/free1/uploads/calculix/original/2X/a/ad93bf1e86d58911b382c8dab3472de06659f0de.png)

- This is a grid photo with 2866 nodes and 5528 elements.

---

<div class="post-metadata">

**Author:** ![rsmith](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/rsmith/32/1684_2.png) [@rsmith](https://calculix.discourse.group/u/rsmith)\
**Post date:** [September 4, 2023, 6:45pm UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728/15 "2023-09-04T18:45:23Z")

</div>

> [@Phonix](#):
>
> his is a grid photo with 2866 nodes and 5528 elements.

The output of the failed restarted run said “nodes: 365457”. So there is something not right.

Are the nodes numbered consecutively, like 1,2,3,4…,2863,2864,2865?  
If not, remake the mesh so that they are. It will save you a lot of memory.

Question; why are you using triangle elements for such a simple geometry?  
Generating this geometry with S8 (“qu8”) element in CalculiX Graphics would be relatively simple and would yield better results with much less elements.

---

<div class="post-metadata">

**Author:** ![Phonix](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@Phonix](https://calculix.discourse.group/u/Phonix)\
**Post date:** [September 5, 2023, 10:13am UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728/16 "2023-09-05T10:13:39Z")

</div>

@rsmith  
The node numbers are consecutive. As for the reason why I used S3, I used calculix to deal with fluid-structure coupling problems, and the flow field solver can only import stl files. I extracted the information in its stl file as node.msh and element.nam of calculix

---

<div class="post-metadata">

**Author:** ![rsmith](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/rsmith/32/1684_2.png) [@rsmith](https://calculix.discourse.group/u/rsmith)\
**Post date:** [September 5, 2023, 6:30pm UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728/17 "2023-09-05T18:30:49Z")

</div>

> [@Phonix](#):
>
> The node numbers are consecutive.

Ok. But why then does the solver run report “nodes: 365457”?

---

<div class="post-metadata">

**Author:** ![Phonix](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@Phonix](https://calculix.discourse.group/u/Phonix)\
**Post date:** [September 6, 2023, 5:46am UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728/18 "2023-09-06T05:46:46Z")

</div>

@rsmith  
I wonder if this is the result of using \*restart,read multiple times?

Since I am using calculix \*restart, the specific operation of read is: Run the.inp file (using \*restart,read requires a.rin file, and running the inp file will generate an rout file), delete the.rin file, change the resulting.rout file to a.rin file as the start file for the next.inp, and run the.inp file again.

The above is the specific process that I use calculix. Is it because of this process that nodes: 365457 is caused?

---

<div class="post-metadata">

**Author:** ![rsmith](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/rsmith/32/1684_2.png) [@rsmith](https://calculix.discourse.group/u/rsmith)\
**Post date:** [September 6, 2023, 5:00pm UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728/19 "2023-09-06T17:00:51Z")

</div>

> [@Phonix](#):
>
> I wonder if this is the result of using \*restart,read multiple times?

Nodes and elements are _generally_ created by the preprocessor, not the solver. (`*REFINE MESH` being the exception that I know of.)

---

<div class="post-metadata">

**Author:** ![jbr](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@jbr](https://calculix.discourse.group/u/jbr)\
**Post date:** [September 7, 2023, 12:19am UTC](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728/20 "2023-09-07T00:19:40Z")

</div>

> [@Phonix](#):
>
> I wonder if this is the result of using \*restart,read multiple times?

Doubt it. In general, your node count remains the same with restarts, and there might even be a restriction about adding more nodes/elements for restarts…

[Next page](https://calculix.discourse.group/t/error-in-u-calloc-error-allocating-memory/1728.md?page=2)
