Memory leak in parallel_reduce

Memory leak in parallel_reduce

Bild des Benutzers Darcy Harrison

Class finish_reduce that has_right_zombie will not call the destructor of the contained body object if the join operation throws.

From parallel_reduce.h:

if( has_right_zombie ) {
   // Right child was stolen.
   Body* s = zombie_space.begin();
   my_body->join( *s );
   s->~Body();
}

Clearly s->~Body() will not be called when my_body->join( *s ) throws. I propose:

if( has_right_zombie ) {
   // Right child was stolen.
   Body* s = zombie_space.begin();
   try{
      my_body->join( *s );
      s->~Body();
   }catch(...){
      s->~Body();
      throw;
   }
}

2 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.
Bild des Benutzers Darcy Harrison

Actually, I remembered that I had submitted essentially the same bug but with respect to cancellation. The solution proposed here: http://software.intel.com/en-us/forums/topic/329081 is better.

Melden Sie sich an, um einen Kommentar zu hinterlassen.