aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorMahouShoujoMivutilde <14999778+MahouShoujoMivutilde@users.noreply.github.com>2022-01-01 09:55:59 +0100
committerGitHub <noreply@github.com>2022-01-01 09:55:59 +0100
commite777adf98534394ca005a1ca541696b06c791aa6 (patch)
treeca62045ac14db93ff173c2b31a47edc34cba568d /main.c
parent1a691d42f6893e7bd6d18d541a9a46d87223c9cc (diff)
downloadnsxiv-e777adf98534394ca005a1ca541696b06c791aa6.tar.zst
Allow setting cache size based on memory percentage (#184)
The problem: 1. For the most people imlib2's default 4MiB is unreasonably low; 2. Hardcoding cache size to ~256MiB has performance benefits and doesn't increase RAM usage too much on relatively modern systems; 3. But we can't do that, because that would be detrimental to low spec systems that (apparently) not (?) building nsxiv from source, as been discussed #171 Solution: Calculate cache size based on total memory. Default is set as 3%, which means: * ~245MiB for 8GiB * ~30MiB for 1GiB * and so on CACHE_SIZE_LIMIT (256MiB by default) sets the highest possible value. And in case we cannot determine the total memory (e.g since _SC_PHYS_PAGES isn't POSIX) use CACHE_SIZE_FALLBACK (32MiB by default) instead. Co-authored-by: NRK <nrk@disroot.org>
Diffstat (limited to 'main.c')
0 files changed, 0 insertions, 0 deletions