K
Klaib
Hi
I am a student doing my project, my program needs a big arrays size.
i used the following functions to create and delete the pointers, but
i have problems based on virtual memory during the the run time "
after 2 or 3 hour", Please help me to increase cBuilder virtual
memory or solving this problem.
Note: i can't reduce the arrays
Thanks a lot for helping
Errors type:
* std:: bad-alloc
* Assertion faild: !" Bad error code", file c:\\helena\\bcc\\util-
common\\vMem.c, line 714
This is the part of my code that i used:
char*** create3Darray(int m, int n, int l)
{
char*** array;
int i;
array = new char**[m];
for (i = 0; i < m; i++)
array = create2Darray(n, l);
return array;
}
//-----------------------------------------------------------
//-------------------------------------------------------------
char** create2Darray(int n, int l)
{
char** array;
int j;
array = new char*[n];
for (j = 0; j < n; j++)
array[j] = new char[l];
return array;
}
//--------------------------------------------------------
//--------------------------------------------------
char* create1Darray(int n)
{
char* array;
array = new char[n];
return array;
}
//---------------------------------------------------------
//----------------------------------------------------
void delete2Darray(char** array, int m)
{
int j;
for(j = 0; j < m; j++)delete [] array[j];
delete [] array;
array=NULL;
}
//---------------------------------------------------------
//----------------------------------------------------
void delete1Darray(char* array)
{
delete [] array;
array=NULL;
}
//-------------------------------------------------
//---------------------------------------------
void delete3Darray(char*** array, int m, int n)
{
int i, j;
for(i = 0; i < m; i++)
{
for(j = 0; j < n; j++)delete [] array[j];
delete [] array;
}
delete [] array;
}
I am a student doing my project, my program needs a big arrays size.
i used the following functions to create and delete the pointers, but
i have problems based on virtual memory during the the run time "
after 2 or 3 hour", Please help me to increase cBuilder virtual
memory or solving this problem.
Note: i can't reduce the arrays
Thanks a lot for helping
Errors type:
* std:: bad-alloc
* Assertion faild: !" Bad error code", file c:\\helena\\bcc\\util-
common\\vMem.c, line 714
This is the part of my code that i used:
char*** create3Darray(int m, int n, int l)
{
char*** array;
int i;
array = new char**[m];
for (i = 0; i < m; i++)
array = create2Darray(n, l);
return array;
}
//-----------------------------------------------------------
//-------------------------------------------------------------
char** create2Darray(int n, int l)
{
char** array;
int j;
array = new char*[n];
for (j = 0; j < n; j++)
array[j] = new char[l];
return array;
}
//--------------------------------------------------------
//--------------------------------------------------
char* create1Darray(int n)
{
char* array;
array = new char[n];
return array;
}
//---------------------------------------------------------
//----------------------------------------------------
void delete2Darray(char** array, int m)
{
int j;
for(j = 0; j < m; j++)delete [] array[j];
delete [] array;
array=NULL;
}
//---------------------------------------------------------
//----------------------------------------------------
void delete1Darray(char* array)
{
delete [] array;
array=NULL;
}
//-------------------------------------------------
//---------------------------------------------
void delete3Darray(char*** array, int m, int n)
{
int i, j;
for(i = 0; i < m; i++)
{
for(j = 0; j < n; j++)delete [] array[j];
delete [] array;
}
delete [] array;
}