]> AND Public Git Repository - simgrid.git/blobdiff - src/smpi/mpi/smpi_datatype_derived.cpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Avoid C-style array.
[simgrid.git] / src / smpi / mpi / smpi_datatype_derived.cpp
index b9c9cf7b5743f7fdd87411d44135efee04405f5e..60ccd26e97ad1e58e49469dfa97f5a6a07781e4f 100644 (file)
@@ -21,6 +21,14 @@ Datatype_contents::Datatype_contents(int combiner, int number_of_integers, const
     , addresses_(addresses, addresses + number_of_addresses)
     , datatypes_(datatypes, datatypes + number_of_datatypes)
 {
+  for (auto& datatype : datatypes_)
+    datatype->ref();
+}
+
+Datatype_contents::~Datatype_contents()
+{
+  for (auto& datatype : datatypes_)
+    Datatype::unref(datatype);
 }
 
 Type_Contiguous::Type_Contiguous(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, MPI_Datatype old_type)