-
Notifications
You must be signed in to change notification settings - Fork 791
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use foonathan memory manager for reducing allocations in SharedMemMan…
…ager.hpp (#3890) * Use foonathan memory manager for reducing allocations in SharedMemManager.hpp (#3833) * Add helpers for std::list node sizes. Signed-off-by: Matthias Schneider <ma30002000@yahoo.de> * Use foonathan memory pool for storing buffer nodes in shared mem manager in order to reduce dynamic heap allocations. Signed-off-by: Matthias Schneider <ma30002000@yahoo.de> * Uncrustify. Signed-off-by: Matthias Schneider <ma30002000@yahoo.de> * Add foonathan dependency to SharedMemTests. Signed-off-by: Matthias Schneider <ma30002000@yahoo.de> * Initialize allocator with more realistic allocation assumption. * Fix include order Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Removed unnecessary constexpr. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Fix copyright year. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Fix EOL. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Fix windows build of unit test. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> --------- Signed-off-by: Matthias Schneider <ma30002000@yahoo.de> Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> Co-authored-by: Miguel Company <MiguelCompany@eprosima.com> (cherry picked from commit df18056) # Conflicts: # test/unittest/transport/CMakeLists.txt * Fix conflicts Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> --------- Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> Co-authored-by: Matthias Schneider <ma30002000@users.noreply.github.com> Co-authored-by: Miguel Company <miguelcompany@eprosima.com>
- Loading branch information
1 parent
9c56825
commit 6938e11
Showing
5 changed files
with
93 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/cpp/utils/collections/impl/node-sizes/foonathan/list_node_size_impl.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima). | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
/** | ||
* @file list_node_size_impl.hpp | ||
*/ | ||
|
||
#ifndef SRC_CPP_UTILS_COLLECTIONS_IMPL_FOONATHAN_LIST_NODE_SIZE_IMPL_HPP_ | ||
#define SRC_CPP_UTILS_COLLECTIONS_IMPL_FOONATHAN_LIST_NODE_SIZE_IMPL_HPP_ | ||
|
||
template <typename T> | ||
struct list_node_size : foonathan::memory::list_node_size<typename std::list<T>::value_type> | ||
{ | ||
}; | ||
|
||
#endif /* SRC_CPP_UTILS_COLLECTIONS_IMPL_FOONATHAN_LIST_NODE_SIZE_IMPL_HPP_ */ |
34 changes: 34 additions & 0 deletions
34
src/cpp/utils/collections/impl/node-sizes/list_node_size_impl.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima). | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
/** | ||
* @file list_node_size_impl.hpp | ||
*/ | ||
|
||
#ifndef SRC_CPP_UTILS_COLLECTIONS_IMPL_LIST_NODE_SIZE_IMPL_HPP_ | ||
#define SRC_CPP_UTILS_COLLECTIONS_IMPL_LIST_NODE_SIZE_IMPL_HPP_ | ||
|
||
#include "./config.hpp" | ||
|
||
#if defined(USE_FOONATHAN_NODE_SIZES) | ||
#include "foonathan/list_node_size_impl.hpp" | ||
#elif defined(USE_STD_NODE_SIZES) | ||
#include "std/list_node_size_impl.hpp" | ||
#elif defined(USE_CUSTOM_NODE_SIZES) | ||
#include "custom/list_node_size_impl.hpp" | ||
#else | ||
#error "Don't now which list_node_size implementation to use" | ||
#endif // NODE SIZE CONFIG | ||
|
||
#endif /* SRC_CPP_UTILS_COLLECTIONS_IMPL_LIST_NODE_SIZE_IMPL_HPP_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters