Merge pull request #10848 from Chocobo1/backport

Backport to v4_1_x
This commit is contained in:
Mike Tzou 2019-06-25 09:01:25 +08:00 committed by GitHub
commit a8bfec081e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 8 deletions

View file

@ -3113,22 +3113,20 @@ void Session::setCheckingMemUsage(int size)
int Session::diskCacheSize() const int Session::diskCacheSize() const
{ {
int size = m_diskCacheSize;
// These macros may not be available on compilers other than MSVC and GCC // These macros may not be available on compilers other than MSVC and GCC
#if defined(__x86_64__) || defined(_M_X64) #if defined(__x86_64__) || defined(_M_X64)
size = qMin(size, 4096); // 4GiB return qMin(m_diskCacheSize.value(), 33554431); // 32768GiB
#else #else
// When build as 32bit binary, set the maximum at less than 2GB to prevent crashes // When build as 32bit binary, set the maximum at less than 2GB to prevent crashes
// allocate 1536MiB and leave 512MiB to the rest of program data in RAM // allocate 1536MiB and leave 512MiB to the rest of program data in RAM
size = qMin(size, 1536); return qMin(m_diskCacheSize.value(), 1536);
#endif #endif
return size;
} }
void Session::setDiskCacheSize(int size) void Session::setDiskCacheSize(int size)
{ {
#if defined(__x86_64__) || defined(_M_X64) #if defined(__x86_64__) || defined(_M_X64)
size = qMin(size, 4096); // 4GiB size = qMin(size, 33554431); // 32768GiB
#else #else
// allocate 1536MiB and leave 512MiB to the rest of program data in RAM // allocate 1536MiB and leave 512MiB to the rest of program data in RAM
size = qMin(size, 1536); size = qMin(size, 1536);

View file

@ -341,7 +341,7 @@ void AdvancedSettings::loadAdvancedSettings()
// When build as 32bit binary, set the maximum at less than 2GB to prevent crashes. // When build as 32bit binary, set the maximum at less than 2GB to prevent crashes.
// These macros may not be available on compilers other than MSVC and GCC // These macros may not be available on compilers other than MSVC and GCC
#if defined(__x86_64__) || defined(_M_X64) #if defined(__x86_64__) || defined(_M_X64)
spinBoxCache.setMaximum(4096); spinBoxCache.setMaximum(33554431); // 32768GiB
#else #else
// allocate 1536MiB and leave 512MiB to the rest of program data in RAM // allocate 1536MiB and leave 512MiB to the rest of program data in RAM
spinBoxCache.setMaximum(1536); spinBoxCache.setMaximum(1536);
@ -350,8 +350,8 @@ void AdvancedSettings::loadAdvancedSettings()
updateCacheSpinSuffix(spinBoxCache.value()); updateCacheSpinSuffix(spinBoxCache.value());
addRow(DISK_CACHE, tr("Disk cache"), &spinBoxCache); addRow(DISK_CACHE, tr("Disk cache"), &spinBoxCache);
// Disk cache expiry // Disk cache expiry
spinBoxCacheTTL.setMinimum(15); spinBoxCacheTTL.setMinimum(1);
spinBoxCacheTTL.setMaximum(600); spinBoxCacheTTL.setMaximum(std::numeric_limits<int>::max());
spinBoxCacheTTL.setValue(session->diskCacheTTL()); spinBoxCacheTTL.setValue(session->diskCacheTTL());
spinBoxCacheTTL.setSuffix(tr(" s", " seconds")); spinBoxCacheTTL.setSuffix(tr(" s", " seconds"));
addRow(DISK_CACHE_TTL, tr("Disk cache expiry interval"), &spinBoxCacheTTL); addRow(DISK_CACHE_TTL, tr("Disk cache expiry interval"), &spinBoxCacheTTL);