Hello,
I have a really hard time in trying to declare a temporary array in C++ using Carpet. The same code used to work just fine with Pugh. The error I am getting at run time is:
malloc: *** error for object 0x102811c08: incorrect checksum for freed object - object was probably modified after being freed.
This appears at the simple attempt to add #include <assert.h> or #include <new> in the header of the file. The header I am using is: #include "cctk.h" #include "cctk_Parameters.h" #include "cctk_Arguments.h"
//#include <assert.h> //#include <new>
#include <cmath> #include <cstdlib> #include <cstdlib> #include <cstdio>
using namespace std;
The way I am trying to define the array is with malloc/free double *reinarray; reinarray = (double*)malloc(n*sizeof(double)); assert(reinarray); .........some code..... free(reinarray)
with new/delete:
double *reinarray; reinarray = new double[n]; ......some code...... delete[] reinarray;
What I am doing wrong?
thanks, Maria