Replace complicated memory pool allocator with plain malloc()#997
Merged
arogge merged 10 commits intobareos:masterfrom Dec 2, 2021
Merged
Replace complicated memory pool allocator with plain malloc()#997arogge merged 10 commits intobareos:masterfrom
arogge merged 10 commits intobareos:masterfrom
Conversation
46f6454 to
b3ce827
Compare
02e31e9 to
24e84ad
Compare
24e84ad to
fd61496
Compare
fd61496 to
1520853
Compare
pstorz
requested changes
Nov 30, 2021
This benchmark shows the performance impact when using poolmem. As a comparison we benchmark against std::string.
Historically, Bareos had pooled memory. However, nowadays operating systems are a lot better at handling memory than we are, so this patch removes the memory pooling and just calls malloc() and free() everytime memory is requested or returned.
This patch removes unused members from struct abufhead and also removes the pool management functions that are now a no-operation (and all calls to them).
Previously, poolmem used a lot of hard-to-read c-style casts. This patch consolidates pointer-arithmetic as much as possible and tries to avoid duplicated code. While changing the code, we also changed the interface a little, all the allocation/deallocation-related functions are now marked noexcept.
This patch adds a test-suite for all functionality in mem_pool.h and mem_pool.cc.
1520853 to
92a44de
Compare
and disable clang-format in char* encode_mode()
This patch removes redundant variants of the same function bodies by simply calling another function with the same functionality where possible.
fbf0831 to
ec67010
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR changes the pool memory implementation to not be pooled anymore.
As it turned out the operating system is a lot better at managing memory than our 20 year old pooling implementation was.
The now non-functional management functions have been removed from the interface and a lot of redundant implementation code has been merged.
We also adds a benchmark and tests for the new implementation.
Furthermore a use-after-free bug was fixed.
Thank you for contributing to the Bareos Project!
Please check
If you have any questions or problems, please give a comment in the PR.
Helpful documentation and best practices
Checklist for the reviewer of the PR (will be processed by the Bareos team)
General
Source code quality
bareos-check-sources --since-mergedoes not report any problemsgit statusshould not report modifications in the source tree after building and testingTests