summaryrefslogtreecommitdiff
path: root/src/basic/mempool.h
Commit message (Collapse)AuthorAgeFilesLines
* mempool: rework mempool_cleanup() to only release freed tilesLennart Poettering2023-02-171-1/+1
| | | | | | | | | | | | | | | | | | This substantially reworks mempool_cleanup() so that it releases pools with all freed tiles only, but keeps all pools with still-allocated tiles around. This is more correct, as the previous implementation just released all pools regardless if anything was still used or not. This would make valgrind shut up but would just hide memory leaks altogether. Moreover if called during regular runtime of a program would result in bad memory accesses all over. Hence, let's add a proper implementation and only trim pools we really know are empty. This way we can safely call these functions later, when under memory pressure, at any time.
* mempool: make mempool_free_tile() return NULLLennart Poettering2023-02-171-1/+1
| | | | | | | To match how we usually do this current allocation code. (Also, make it accept a NULL pointer, also in order to match behaviour in the rest of our codebase)
* mempool: use size_t for all memory object sizes and countsLennart Poettering2023-02-171-1/+1
|
* hashmap: expose helper for releasing memory pools independently of valgrindLennart Poettering2023-02-171-2/+0
| | | | | Let's clean this up and export this always, so that we can later call when we are under memory pressure.
* Turn mempool_enabled() into a weak symbolZbigniew Jędrzejewski-Szmek2022-06-291-2/+1
| | | | | | | | | | | | | | | Before we had the following scheme: mempool_enabled() would check mempool_use_allowed, and libsystemd-shared would be linked with a .c file that provides mempool_use_allowed=true, while other things would linked with a different .c file with mempool_use_allowed=false. In the new scheme, mempool_enabled() itself is a weak symbol. If it's not found, we assume false. So it only needs to be provided for libsystemd-shared, where it can return false or true. test-set-disable-mempool is libshared, so it gets the symbol. But then we actually disable the mempool via envvar. mempool_enable() is called to check its return value directly.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* mempool: only enable mempool use when linked to libsystemd-shared.soZbigniew Jędrzejewski-Szmek2018-10-111-0/+2
| | | | | | | | | | | Mempool use is enabled or disabled based on the mempool_use_allowed symbol that is linked in. Should fix assert crashes in external programs caused by #9792. Replaces #10286. v2: - use two different source files instead of a gcc constructor
* Move use_pool() to mempool.c and rename to mempool_enabled()Zbigniew Jędrzejewski-Szmek2018-10-111-0/+2
| | | | The only user is in hashmap.c, but it's a mempool thing.
* tree-wide: drop double newlineYu Watanabe2018-06-291-1/+0
|
* tree-wide: drop copyright headers from frequent contributorsZbigniew Jędrzejewski-Szmek2018-06-201-3/+0
| | | | | | | | Fixes #9320. for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms' done
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-06-141-1/+1
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-1/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: remove some double newlines in headers, tooLennart Poettering2018-05-221-1/+0
|
* Turn VALGRIND variable into a meson configuration switchZbigniew Jędrzejewski-Szmek2018-05-171-1/+1
| | | | | | | | | | Configuration through environment variable is inconvenient with meson, because they cannot be convieniently changed and/or are not preserved during reconfiguration (https://github.com/mesonbuild/meson/issues/1503). This adds -Dvalgrind=true/false, which has the advantage that it can be set at any time with meson configure -Dvalgrind=... and ninja will rebuild targets as necessary. Additional minor advantages are better consistency with the options for hashmap debugging, and typo avoidance with '#if' instead of '#ifdef'.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* tree-wide: make more global variables staticLennart Poettering2016-02-131-1/+1
| | | | let's export as little as we can
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* build-sys: split internal basic/ library from shared/Kay Sievers2015-06-111-0/+49
basic/ can be used by everything cannot use anything outside of basic/ libsystemd/ can use basic/ cannot use shared/ shared/ can use libsystemd/