Hi
I am getting this error when running a very similar code like the
below.
I have memory problem,but i dont know how can solve it.
please help.
Thanks in advance.
///////////////////////////////////////////
~~~~~~~ERROR~~~~~~~~
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Aborted
///////////////////////////////////////////
~~~~~~~~Code~~~~~~~~~
int main(){
/** Declare classes **/
for(long int i = 0 ; i < 50000 ; i++){
class Rahim *rahim = new Rahim( (unsigned)(i));
class Bahram *bahram = new Bahram;
class Asgar *asgar = new Asgar;
/*****Body of the code******/
throw( asgar, bahram , Rahim );
delete (bahram);
delete (Rahim);
delete (asgar);
}//end for
return 0;
}
void throw(class Asgar *asgar, class Bbahram *bahram ,class Rahim *Raahim ){
/** Declare variables **/
long int time;
long int step = 1999;
/** Time Loop **/
for( time = 0 ;time < GT ;time++ ){
get_bahram( bahram, Rahim );
asgar -> get_coordinates ( bahram , time );
if(step == time){
long int time_Rg = (step + 1);
asgar -> calculate_r ( time_Rg );
step += 2000;
}//end if
} //end for
} //end function
.
.
.
/**************************/