Skip to content

Commit

Permalink
Free created types in destructors
Browse files Browse the repository at this point in the history
  • Loading branch information
mphoward committed Nov 20, 2024
1 parent b116410 commit 379afa9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions hoomd/MPIConfiguration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ MPIConfiguration::MPIConfiguration(
#endif
}

MPIConfiguration::~MPIConfiguration()
{
MPI_Type_free(&m_mpi_scalar2);
MPI_Type_free(&m_mpi_scalar3);
MPI_Type_free(&m_mpi_vec3_scalar);
MPI_Type_free(&m_mpi_scalar4);
}

void MPIConfiguration::splitPartitions(unsigned int nrank)
{
#ifdef ENABLE_MPI
Expand Down
2 changes: 1 addition & 1 deletion hoomd/MPIConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class PYBIND11_EXPORT MPIConfiguration
);

//! Destructor
virtual ~MPIConfiguration() { };
virtual ~MPIConfiguration();

#ifdef ENABLE_MPI
MPI_Comm operator()() const
Expand Down
3 changes: 3 additions & 0 deletions hoomd/mpcd/ParticleData.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ mpcd::ParticleData::ParticleData(const mpcd::ParticleDataSnapshot& snapshot,
mpcd::ParticleData::~ParticleData()
{
m_exec_conf->msg->notice(5) << "Destroying MPCD ParticleData" << endl;
#ifdef ENABLE_MPI
MPI_Type_free(&m_mpi_pdata_element);
#endif // ENABLE_MPI
}

/*!
Expand Down

0 comments on commit 379afa9

Please sign in to comment.