diff options
author | Mayeul Cantan <oss+nheko@mayeul.net> | 2022-07-20 12:44:07 +0200 |
---|---|---|
committer | Mayeul Cantan <oss+nheko@mayeul.net> | 2022-07-20 12:44:07 +0200 |
commit | fb2e019591a42f07b3431eee4ce39f6226f208fc (patch) | |
tree | d240602d543a9291da5d30d19039ac8ae2088fe6 /src/Cache.cpp | |
parent | Better handle 32-bit platforms by limitting database size (diff) | |
download | nheko-fb2e019591a42f07b3431eee4ce39f6226f208fc.tar.xz |
fixup! Better handle 32-bit platforms by limitting database size
Diffstat (limited to '')
-rw-r--r-- | src/Cache.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Cache.cpp b/src/Cache.cpp index 9782ee99..a4af4d25 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -46,17 +46,18 @@ static const std::string_view OLM_ACCOUNT_KEY("olm_account"); static const std::string_view CACHE_FORMAT_VERSION_KEY("cache_format_version"); static const std::string_view CURRENT_ONLINE_BACKUP_VERSION("current_online_backup_version"); -constexpr auto MAX_DBS = 32384UL; -#if Q_PROCESSOR_WORDSIZE == 8 // 64-bit +constexpr auto MAX_DBS = 32384UL; +constexpr auto BATCH_SIZE = 100; + +#if Q_PROCESSOR_WORDSIZE >= 5 // 40-bit or more, up to 2^(8*WORDSIZE) words addressable. constexpr auto DB_SIZE = 32ULL * 1024ULL * 1024ULL * 1024ULL; // 32 GB constexpr size_t MAX_RESTORED_MESSAGES = 30'000; #elif Q_PROCESSOR_WORDSIZE == 4 // 32-bit address space limits mmaps constexpr auto DB_SIZE = 1ULL * 1024ULL * 1024ULL * 1024ULL; // 1 GB constexpr size_t MAX_RESTORED_MESSAGES = 5'000; #else -#error unknown word size on target CPU +#error Not enough virtual address space for the database on target CPU #endif -constexpr auto BATCH_SIZE = 100; //! Cache databases and their format. //! |