-
Notifications
You must be signed in to change notification settings - Fork 791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use foonathan memory manager for reducing allocations in SharedMemManager.hpp #3833
Use foonathan memory manager for reducing allocations in SharedMemManager.hpp #3833
Conversation
@ma30002000 Thank you for your contribution. I would use the input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ma30002000 Thank you for such a well-crafted contribution.
I took the liberty of rebasing and adding some commits with some minor changes, so we could get this into the 2.12.0 release.
LGTM with green CI.
@richiprosima Please test this |
@richiprosima Please test windows |
@richiprosima Please test this |
@richiprosima Please test this |
@richiprosima Please test linux and test windows |
@richiprosima Please test discovery-server |
@Mergifyio rebase |
Signed-off-by: Matthias Schneider <ma30002000@yahoo.de>
…ger in order to reduce dynamic heap allocations. Signed-off-by: Matthias Schneider <ma30002000@yahoo.de>
Signed-off-by: Matthias Schneider <ma30002000@yahoo.de>
Signed-off-by: Matthias Schneider <ma30002000@yahoo.de>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
✅ Branch has been successfully rebased |
@richiprosima please test this |
@Mergifyio backport 2.11.x 2.10.x 2.6.x |
✅ Backports have been created
|
…ager.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
…ager.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
…ager.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
Thanks a lot for all the additional work and bringing my changes to the 2.12 release! |
…ager.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>
…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>
…ager.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 Signed-off-by: EduPonz <eduardoponz@eprosima.com>
…ager.hpp (#3833) (#3889) * 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 Signed-off-by: EduPonz <eduardoponz@eprosima.com> * Fix conflicts Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> Signed-off-by: EduPonz <eduardoponz@eprosima.com> --------- Signed-off-by: Matthias Schneider <ma30002000@yahoo.de> Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> Signed-off-by: EduPonz <eduardoponz@eprosima.com> Co-authored-by: Matthias Schneider <ma30002000@users.noreply.github.com> Co-authored-by: Miguel Company <MiguelCompany@eprosima.com>
…ager.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
…ager.hpp (#3833) (#3888) * 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>
Description
When receiving subscribed messages via shared memory, the only periodic heap allocations originate in the free_buffers_ and allocated_buffers_ lists in the Segment class (ShmMemoryManager.hpp). This PR replaces the std::lists' default allocator with a foonathan provided one as indicated by the FIXME left in the code.
It would be nice to clarify if an initial size of 1 buffer is a decent starting value.
@Mergifyio backport 2.11.x 2.10.x 2.6.x
Contributor Checklist
versions.md
file (if applicable).Reviewer Checklist