D
dade
Hi,
i use a dynamic 3D matrix of structure that yields to a 90Mb of RAM
allocated.
To do that i use new operator. here a portion of code
struct SInfo
{
int i1;
int i2;
float f1;
float f2;
}
SInfo ***pCoord = new SInfo **[iELM_MAT_R];
for(j=0; j<iELM_MAT_R; j++)
{
pCoord[j] = new SInfo *[iELM_MAT_C];
for(k=0; k<iELM_MAT_C; k++)
{
pCoord[j][k] = new SInfo[MAX_ELM];
}
}
and it works...but i read that it is better to use malloc and free
instead of new and delete to avoid memory leaks.
i don't see error in my code but i'd like to know if there is something
i'm skipping...
thanks
Davide
i use a dynamic 3D matrix of structure that yields to a 90Mb of RAM
allocated.
To do that i use new operator. here a portion of code
struct SInfo
{
int i1;
int i2;
float f1;
float f2;
}
SInfo ***pCoord = new SInfo **[iELM_MAT_R];
for(j=0; j<iELM_MAT_R; j++)
{
pCoord[j] = new SInfo *[iELM_MAT_C];
for(k=0; k<iELM_MAT_C; k++)
{
pCoord[j][k] = new SInfo[MAX_ELM];
}
}
and it works...but i read that it is better to use malloc and free
instead of new and delete to avoid memory leaks.
i don't see error in my code but i'd like to know if there is something
i'm skipping...
thanks
Davide