Allow linking alternate memory management implementations#454
Merged
hummeltech merged 3 commits intoopenstreetmap:masterfrom Jun 29, 2024
Merged
Allow linking alternate memory management implementations#454hummeltech merged 3 commits intoopenstreetmap:masterfrom
hummeltech merged 3 commits intoopenstreetmap:masterfrom
Conversation
The core issue seems to be the memory management combined with the memory usage pattern of renderd. The glib-provided heap implementation somehow fails to give back memory to the system, but instead keeps on growing the data segment until the system decides to kill the process. The jemalloc implementation puts allocations into arenas and once they are freed (and some time has passed), they are given back to the system and seem to reduce the RSS size of the process. This should address/alleviate openstreetmap#181
Default is `glib`, which seems to have issues with increased memory consumption. Alternatives are `jemalloc` and `tcmalloc`. To select a different library, configure the build folder, then run `ccmake <build_folder>` to configure the option `MALLOC_LIB`. For automated configuration, run, add `-DMALLOC_LIB=jemalloc` or `-DMALLOC_LIB=tcmalloc` to the `cmake` configuration command line.
fcb7efb to
b3b39bc
Compare
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #454 +/- ##
==========================================
+ Coverage 81.54% 84.26% +2.72%
==========================================
Files 24 24
Lines 5645 5321 -324
==========================================
- Hits 4603 4484 -119
+ Misses 1042 837 -205 ☔ View full report in Codecov by Sentry. |
hummeltech
added a commit
that referenced
this pull request
Jun 29, 2024
…454) With new `CMake CACHE` entry `MALLOC_LIB`, supporting the following values: * `libc` (default): Use the system's implementation * `jemalloc`: Use [jemalloc](http://jemalloc.net) * `mimalloc`: Use [mimalloc](https://github.com/microsoft/mimalloc) * `tcmalloc`: Use [tcmalloc](https://github.com/google/tcmalloc) Co-authored-by: Roland Bosa <roland.bosa@gmail.com>
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.
With new
CMake CACHEentryMALLOC_LIB, supporting the following values:libc(default): Use the system's implementationjemalloc: Use jemallocmimalloc: Use mimalloctcmalloc: Use tcmalloc