queso icon indicating copy to clipboard operation
queso copied to clipboard

Using `std::default_delete<MpiComm>` is undefined behaviour

Open dmcdougall opened this issue 8 years ago • 2 comments

Example

dmcdougall avatar May 25 '17 16:05 dmcdougall

Actually, no it isn't, because MpiComm is a QUESO object, not an MPI object.

That said, we're committing other atrocities:

  1. We straight up copy communicators, including context, rather than calling MPI_Comm_dup;
  2. We don't call MPI_Comm_free on communicators in MpiComm::~MpiComm;
  3. If we did do 2., then upon reaching the end of whatever scope contains FullEnvironment, presumably MPI_Finalize() would have already been called and then after that we start calling MPI_Comm_free. MPI would error;
  4. Fixing 3. by doing 2. means users need to scope all of QUESO's objects which is a backwards-incompatible change;
  5. We could call MPI_Finalized() to test if MPI_Finalize() was called and if it was, don't call MPI_Comm_free. This introduces memory leaks;

dmcdougall avatar May 26 '17 00:05 dmcdougall

Related issue: #587.

dmcdougall avatar Jun 07 '17 15:06 dmcdougall