HI Ray,
  
  You can solve these segmentation faults yourself. Use tool like gdb for  
that. To create core dump / stack where the fault is you should run the  
following command in linux bash shell "ulimit -a unlimited". The next  time you 
run your program you would core dump and a file named "core"  would be 
genereated.
  The use "gdb <binary_file_name> <core>" to see where the  core dumped. Seatch 
net for more info. reg this. Solving by this you  can be master of C.
  
  Avinash

Ray Devore <[EMAIL PROTECTED]> wrote:                                           
       --- lul_hs <[EMAIL PROTECTED]> wrote:
  > Hi all,
  > 
  > I face a segmentation fault problem working with c++
  > under RedHat 
  > linux 9.0
  > Sometimes it runs correctly and other time it gives
  > a segmentation 
  > fault when the input is bigger(accesses).
  > 
  > Here is some code segments.
  > 
  > ....
  > L1Cache=
  > (int*)malloc(L1NumBlocks*a11*sizeof(unsigned int));
  > L1FaCache=
  > (int*)malloc(L1NumBlocks*2*sizeof(unsigned int));
  > .
  > .
  > unsigned int *cold, *cCold;
  > cold = new unsigned int(accesses);
  > cout<<"thereee\n";
  > cCold=cold;
  > .
  > .
  > if(L1Cache[1+a11*L1Index]== L1Tag)
  > {
  > L1Hits++; hit=true; //cout<<" hit\n";
  > continue; }
  > else {
  > bool c=false;
  > int h=0;
  > for( h=0;h<L1Cold ;h++)
  > if(cCold[h]==L1Tag){c=true;  mis++; } 
  > if(!c) { cold[L1Cold]=L1Tag; L1Cold++;
  > }
  > 
  > I woulg be greatfull if anyone can help me
  > 
  > 
  The following initializes "cold" with the value
  "accesses"
  cold = new unsigned int(accesses) ;
  
  The following sets up "cold" as a dynamic array of
  "accesses" values.
  cold = new unsigned int[accesses] ;
  
  Which do you want?
  
  Ray
  
  __________________________________________________________
  Sponsored Link
  
  Don't quit your job - take classes online
  www.Classesusa.com
  
  
      
                                    

                
---------------------------------
 All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease 
of use." - PC Magazine

Reply via email to