need help on memory leak
-
Dear All... I have problems in avoiding memory leak. I've browsed through the message board regarding memory leak, but still can not find solution. I have this function:
void CPA003Dlg::doMultiplyT(double **A, int M) { double temp_Sum = 0; double **B; B = new double *[M]; for (int x=0;x what should I do? thanks...
-
Dear All... I have problems in avoiding memory leak. I've browsed through the message board regarding memory leak, but still can not find solution. I have this function:
void CPA003Dlg::doMultiplyT(double **A, int M) { double temp_Sum = 0; double **B; B = new double *[M]; for (int x=0;x what should I do? thanks...
houari_id wrote:
for (int x=0;x for (x=0;x B[x][0] = A[0][M]; B[x][1] = A[1][M]; }
houari_id wrote:
for (int z=0; z temp_Sum += (A[x][z]*B[z][y]); }
i guess this is not what you wanted to type... so, use the little [Modify] link at the botton of your post and there, uncheck the Ignore HTML tags in this message checkbox... thanks
TOXCCT >>> GEII power
[toxcct][VisualCalc] -
houari_id wrote:
for (int x=0;x for (x=0;x B[x][0] = A[0][M]; B[x][1] = A[1][M]; }
houari_id wrote:
for (int z=0; z temp_Sum += (A[x][z]*B[z][y]); }
i guess this is not what you wanted to type... so, use the little [Modify] link at the botton of your post and there, uncheck the Ignore HTML tags in this message checkbox... thanks
TOXCCT >>> GEII power
[toxcct][VisualCalc]Mmmhhh, forgot to uncheck the 'Ignore HTML tags' ? :rolleyes:
-
Dear All... I have problems in avoiding memory leak. I've browsed through the message board regarding memory leak, but still can not find solution. I have this function:
void CPA003Dlg::doMultiplyT(double **A, int M) { double temp_Sum = 0; double **B; B = new double *[M]; for (int x=0;x what should I do? thanks...
houari_id wrote:
what should I do?
Your use of a 2D array is incorrect. Try:
double **B = new double*[FirstDimension];
for (int x = 0; x < FirstDimension; x++)
{
= new double[SecondDimension];
for (int y = 0; y < SecondDimension; y++)
{
B[x][y] = 0.0; // initialize to some value
}
}
...
for (x = 0; x < FirstDimension; x++)
delete [] B[x];delete [] B;
"Take only what you need and leave the land as you found it." - Native American Proverb
-
Mmmhhh, forgot to uncheck the 'Ignore HTML tags' ? :rolleyes:
arf, nop :D actually, when a Copied/pasted the checkbox caption, i did not see that i checked it... and as CP is so slow some times, you answered before i had the time to uncheck it ;P but it's fixed now ;)
TOXCCT >>> GEII power
[toxcct][VisualCalc] -
Mmmhhh, forgot to uncheck the 'Ignore HTML tags' ? :rolleyes:
-
houari_id wrote:
what should I do?
Your use of a 2D array is incorrect. Try:
double **B = new double*[FirstDimension];
for (int x = 0; x < FirstDimension; x++)
{
= new double[SecondDimension];
for (int y = 0; y < SecondDimension; y++)
{
B[x][y] = 0.0; // initialize to some value
}
}
...
for (x = 0; x < FirstDimension; x++)
delete [] B[x];delete [] B;
"Take only what you need and leave the land as you found it." - Native American Proverb