From: Wolfgang Bangerth Date: Tue, 2 Jan 2024 18:24:20 +0000 (-0700) Subject: Avoid dynamic memory allocation when we know that we won't need it. X-Git-Tag: relicensing~207^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75b36e5e4d5aca925037d4a001b66326075c5bed;p=dealii.git Avoid dynamic memory allocation when we know that we won't need it. --- diff --git a/source/lac/trilinos_sparse_matrix.cc b/source/lac/trilinos_sparse_matrix.cc index 231e9e3f83..8da0925382 100644 --- a/source/lac/trilinos_sparse_matrix.cc +++ b/source/lac/trilinos_sparse_matrix.cc @@ -1424,9 +1424,9 @@ namespace TrilinosWrappers TrilinosWrappers::types::int_type n_columns; boost::container::small_vector local_value_array( - n_cols); + elide_zero_values ? n_cols : 0); boost::container::small_vector - local_index_array(n_cols); + local_index_array(elide_zero_values ? n_cols : 0); // If we don't elide zeros, the pointers are already available... need to // cast to non-const pointers as that is the format taken by Trilinos (but