Why reference counts


Up: MPI Objects Next: Tools for evaluating programs Previous: Reference counting

Why not just free the object?

Consider this library routine:

void MakeDatatype( nx, ny, ly, lz, MPI_Datatype *new ) 
{ 
MPI_Datatype newx1; 
MPI_Type_vector( ly, 1, nx, MPI_DOUBLE, &newx1 ); 
MPI_Type_hvector( lz, 1, nx*ny*sizeof(double), newx1,  
                  new ); 
MPI_Type_free( &newx1 ); 
MPI_Type_commit( new ); 
} 
Without the MPI_Type_free( &newx1 ), it would be very awkward to later free newx1 when new was freed.



Up: MPI Objects Next: Tools for evaluating programs Previous: Reference counting