diff --git a/include/boost/mpi/datatype.hpp b/include/boost/mpi/datatype.hpp index 6e104c1..b9d4902 100644 --- a/include/boost/mpi/datatype.hpp +++ b/include/boost/mpi/datatype.hpp @@ -320,6 +320,7 @@ BOOST_MPI_DATATYPE(signed char, MPI_SIGNED_CHAR, builtin); namespace detail { inline MPI_Datatype build_mpi_datatype_for_bool() { + // this is explicitly freed in mpi_datatype_map::clear MPI_Datatype type; MPI_Type_contiguous(sizeof(bool), MPI_BYTE, &type); MPI_Type_commit(&type); diff --git a/src/mpi_datatype_cache.cpp b/src/mpi_datatype_cache.cpp index 8437e9d..1f8607f 100644 --- a/src/mpi_datatype_cache.cpp +++ b/src/mpi_datatype_cache.cpp @@ -8,6 +8,7 @@ #include #include +#include #include namespace boost { namespace mpi { namespace detail { @@ -34,6 +35,9 @@ namespace boost { namespace mpi { namespace detail { // ignore errors in the destructor for (stored_map_type::iterator it=impl->map.begin(); it != impl->map.end(); ++it) MPI_Type_free(&(it->second)); + // We explicitly created this one, as there is no equivalent in the MPI standard + MPI_Datatype bool_type = get_mpi_datatype(bool()); + MPI_Type_free(&bool_type); } }