--- 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

Reply via email to