mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 13:04:23 +00:00
Merge pull request #4035 from Chocobo1/reduce_cache
Reduce max value of "Disk cache size"
This commit is contained in:
commit
45dbfe80a1
@ -1378,37 +1378,26 @@ void Preferences::setShutdownqBTWhenDownloadsComplete(bool shutdown)
|
|||||||
uint Preferences::diskCacheSize() const
|
uint Preferences::diskCacheSize() const
|
||||||
{
|
{
|
||||||
uint size = value("Preferences/Downloads/DiskWriteCacheSize", 0).toUInt();
|
uint size = value("Preferences/Downloads/DiskWriteCacheSize", 0).toUInt();
|
||||||
|
|
||||||
// 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(_M_X64) && !defined(__amd64__)
|
#if defined(__x86_64__) || defined(_M_X64)
|
||||||
//1800MiB to leave 248MiB room to the rest of program data in RAM
|
size = qMin(size, (uint) 4096); // 4GiB
|
||||||
if (size > 1800)
|
|
||||||
size = 1800;
|
|
||||||
#else
|
#else
|
||||||
// 4GiB
|
// When build as 32bit binary, set the maximum at less than 2GB to prevent crashes
|
||||||
if (size > 4 * 1024)
|
// allocate 1536MiB and leave 512MiB to the rest of program data in RAM
|
||||||
size = 4 * 1024;
|
size = qMin(size, (uint) 1536);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::setDiskCacheSize(uint size)
|
void Preferences::setDiskCacheSize(uint size)
|
||||||
{
|
{
|
||||||
uint size0 = size;
|
#if defined(__x86_64__) || defined(_M_X64)
|
||||||
|
size = qMin(size, (uint) 4096); // 4GiB
|
||||||
#if !defined(_M_X64) && !defined(__amd64__)
|
|
||||||
//1800MiB to leave 248MiB room to the rest of program data in RAM
|
|
||||||
if (size0 > 1800)
|
|
||||||
size0 = 1800;
|
|
||||||
#else
|
#else
|
||||||
// 4GiB
|
// allocate 1536MiB and leave 512MiB to the rest of program data in RAM
|
||||||
if (size0 > 4 * 1024)
|
size = qMin(size, (uint) 1536);
|
||||||
size0 = 4 * 1024;
|
|
||||||
#endif
|
#endif
|
||||||
|
setValue("Preferences/Downloads/DiskWriteCacheSize", size);
|
||||||
setValue("Preferences/Downloads/DiskWriteCacheSize", size0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint Preferences::diskCacheTTL() const
|
uint Preferences::diskCacheTTL() const
|
||||||
|
@ -208,12 +208,11 @@ private slots:
|
|||||||
spin_cache.setMinimum(0);
|
spin_cache.setMinimum(0);
|
||||||
// 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(_M_X64) && !defined(__amd64__)
|
#if defined(__x86_64__) || defined(_M_X64)
|
||||||
//1800MiB to leave 248MiB room to the rest of program data in RAM
|
spin_cache.setMaximum(4096);
|
||||||
spin_cache.setMaximum(1800);
|
|
||||||
#else
|
#else
|
||||||
// 4GiB
|
// allocate 1536MiB and leave 512MiB to the rest of program data in RAM
|
||||||
spin_cache.setMaximum(4*1024);
|
spin_cache.setMaximum(1536);
|
||||||
#endif
|
#endif
|
||||||
spin_cache.setValue(pref->diskCacheSize());
|
spin_cache.setValue(pref->diskCacheSize());
|
||||||
updateCacheSpinSuffix(spin_cache.value());
|
updateCacheSpinSuffix(spin_cache.value());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user