CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   memory allocation issue using Field<vector> (https://www.cfd-online.com/Forums/openfoam/220055-memory-allocation-issue-using-field-vector.html)

CFDMi August 22, 2019 04:31

memory allocation issue using Field<vector>
 
Hi all!

The issue concerns following declaration:

Field<vector> subCellPos(10000, vector::zero);

It does not produce an error at compile time, rather shows up at runtime at the first instance of it. The funny thing is, that sometimes the code runs fine past this line (I cannot tell if it would work for more timesteps, since I have another issue later in the code). The error given most of the time is corrupted size vs. prev_size or sometimes malloc: invalid chunk size.
I am certain that this line causes the crash, but unfortunately I am not experienced enough to fix this issue. I tried creating a smaller field with size 5 instead of 10000 and that works fine apparently, so my guess is it has something to do with stack size?

Thanks in advance for any replies!

CFDMi August 22, 2019 04:43

Probably not a stack size issue, because I get the same error when declaring it on the heap using the new keyword.

CFDMi August 23, 2019 03:23

The error was not caused by this line of code, even though debugging with Info messages made it seem as though it was.

anhkenyt May 11, 2020 02:08

I am having a similar problem,
Can you give me some advice to fix it ?
Thanks,

CFDMi May 11, 2020 02:53

Like I said, the error in my case was somewhere else... Usually something wrong with a pointer/reference or maybe you are trying to access an out of bounds list entry (or some other reason).

With enough patience you will find it!


All times are GMT -4. The time now is 06:39.