queso
queso copied to clipboard
Using `std::default_delete<MpiComm>` is undefined behaviour
Actually, no it isn't, because MpiComm is a QUESO object, not an MPI object.
That said, we're committing other atrocities:
-
We straight up copy communicators, including context, rather than calling
MPI_Comm_dup; -
We don't call
MPI_Comm_freeon communicators inMpiComm::~MpiComm; -
If we did do 2., then upon reaching the end of whatever scope contains
FullEnvironment, presumablyMPI_Finalize()would have already been called and then after that we start callingMPI_Comm_free. MPI would error; - Fixing 3. by doing 2. means users need to scope all of QUESO's objects which is a backwards-incompatible change;
- We could call
MPI_Finalized()to test ifMPI_Finalize()was called and if it was, don't callMPI_Comm_free. This introduces memory leaks;
Related issue: #587.