From: Wolfgang Bangerth Date: Fri, 20 Oct 2017 16:52:44 +0000 (-0600) Subject: Make sure we call 'free()' instead of 'delete[]'. X-Git-Tag: v9.0.0-rc1~911^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5ce623f0be14a35b1adf42bdcd5773da925760e;p=dealii.git Make sure we call 'free()' instead of 'delete[]'. --- diff --git a/include/deal.II/lac/la_parallel_vector.h b/include/deal.II/lac/la_parallel_vector.h index 7988201261..08721841e1 100644 --- a/include/deal.II/lac/la_parallel_vector.h +++ b/include/deal.II/lac/la_parallel_vector.h @@ -1082,8 +1082,12 @@ namespace LinearAlgebra /** * Pointer to the array of local elements of this vector. + * + * Because we allocate these arrays via Utilities::System::posix_memalign, + * we need to use a custom deleter for this object that does not call + * delete[], but instead calls @p free(). */ - std::unique_ptr values; + std::unique_ptr values; /** * For parallel loops with TBB, this member variable stores the affinity diff --git a/include/deal.II/lac/la_parallel_vector.templates.h b/include/deal.II/lac/la_parallel_vector.templates.h index 5edb5c8db1..c120889a0e 100644 --- a/include/deal.II/lac/la_parallel_vector.templates.h +++ b/include/deal.II/lac/la_parallel_vector.templates.h @@ -204,7 +204,7 @@ namespace LinearAlgebra : partitioner (new Utilities::MPI::Partitioner()), allocated_size (0), - values (nullptr) + values (nullptr, &free) { reinit(0); } @@ -216,7 +216,7 @@ namespace LinearAlgebra : Subscriptor(), allocated_size (0), - values (nullptr), + values (nullptr, &free), vector_is_ghosted (false) { reinit (v, true); @@ -240,7 +240,7 @@ namespace LinearAlgebra const MPI_Comm communicator) : allocated_size (0), - values (nullptr), + values (nullptr, &free), vector_is_ghosted (false) { reinit (local_range, ghost_indices, communicator); @@ -253,7 +253,7 @@ namespace LinearAlgebra const MPI_Comm communicator) : allocated_size (0), - values (nullptr), + values (nullptr, &free), vector_is_ghosted (false) { reinit (local_range, communicator); @@ -265,7 +265,7 @@ namespace LinearAlgebra Vector::Vector (const size_type size) : allocated_size (0), - values (nullptr), + values (nullptr, &free), vector_is_ghosted (false) { reinit (size, false); @@ -278,7 +278,7 @@ namespace LinearAlgebra Vector (const std::shared_ptr &partitioner) : allocated_size (0), - values (nullptr), + values (nullptr, &free), vector_is_ghosted (false) { reinit (partitioner);