Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: access violation at 0x00862847: read of address 0x000000a0 ?


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: May 16, 2017 2:59 AM Last Post By: Asger Joergensen
boualem Ait Mes...

Posts: 12
Registered: 4/19/17
access violation at 0x00862847: read of address 0x000000a0 ?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 15, 2017 6:52 AM
after using the parallel library i had a access violation can anyone please help me ?
this is ma loop befor using the parallel loop :

for(int i=0;i<donnees_initiales.gettab_points().size();i++)
	   {
		 int indice_I=(int) ((donnees_initiales.gettab_points()[i].getx() - donnees_initiales.getxmin())/pas_x);
		 if(indice_I==nb_x) indice_I--;
 
		 int indice_J=(int) ((donnees_initiales.gettab_points()[i].gety() - donnees_initiales.getymin())/pas_y);
		 if(indice_J==nb_y) indice_J--;
 
		 int indice_K=(int) ((donnees_initiales.gettab_points()[i].getz() - donnees_initiales.getzmin())/pas_z);
		 if(indice_K==nb_z) indice_K--;
 
 
		 sous_nuages[indice_I][indice_J][indice_K].inserer_point(donnees_initiales.gettab_points()[i]);
 
}


and this is after

TParallel::For(Sender,0,donnees_initiales.gettab_points().size()-1,affectation_pts_sous_nuage);
 
void  __fastcall TForm66666::affectation_pts_sous_nuage(TObject *Sender,int AIndex)
	   {
		 int indice_I=(int) ((donnees_initiales.gettab_points()[AIndex].getx() - donnees_initiales.getxmin())/pas_x);
		 if(indice_I==nb_x) indice_I--;
 
		 int indice_J=(int) ((donnees_initiales.gettab_points()[AIndex].gety() - donnees_initiales.getymin())/pas_y);
		 if(indice_J==nb_y) indice_J--;
 
		 int indice_K=(int) ((donnees_initiales.gettab_points()[AIndex].getz() - donnees_initiales.getzmin())/pas_z);
		 if(indice_K==nb_z) indice_K--;
 
 
		 sous_nuages[indice_I][indice_J][indice_K].inserer_point(donnees_initiales.gettab_points()[AIndex]);
 
}
 


and sous_nuages is a vector
i think i am having a Memory leak but i don't know how to solve this problem
thanks for helping me
Asger Joergensen

Posts: 370
Registered: 11/18/08
Re: access violation at 0x00862847: read of address 0x000000a0 ?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 16, 2017 2:59 AM   in response to: boualem Ait Mes... in response to: boualem Ait Mes...
Hi boualem

I don't know anything about parallel for, but I do believe if you
optimise your code it will run a good deal faster:

something like:

int minX = donnees_initiales.getxmin(); //these seem to be the same in every loop
int minY = donnees_initiales.getymin(); //so this will eliminate a lot of function calls
int minZ = donnees_initiales.getzmin();

int C = donnees_initiales.gettab_points().size();// only one call
for( int i = 0; i < C; ++i )
{
TDigp &Digp = donnees_initiales.gettab_points()[i]; // only one call per loop

int indice_I = (int)( ( Digp.getx() - minX ) / pas_x );
if( indice_I == nb_x ) indice_I--;

int indice_J = (int)( ( Digp.gety() - minY ) / pas_y );
if( indice_J == nb_y ) indice_J--;

int indice_K = (int)( ( Digp.getz() - minZ ) / pas_z );
if( indice_K == nb_z ) indice_K--;

sous_nuages[indice_I][indice_J][indice_K].inserer_point( Digp );
}

Best regards
Asger

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02