Enabling Windows disk cache (and adding option to disable it) to prevent a relatively prevalent ERROR_INVALID_PARAMETER.

From my test only the write cache was the culprit, if this can be confirmed the read cache can be disabled by default if that has a benefit.

(Other systems are unchanged.)
This commit is contained in:
John Peterson 2012-12-03 17:22:40 +01:00
parent b2b959d5e3
commit 31ffbb1edd
3 changed files with 29 additions and 8 deletions

View file

@ -404,12 +404,9 @@ void QBtSession::configureSession() {
sessionSettings.auto_scrape_min_interval = 900; // 15 minutes
sessionSettings.cache_size = pref.diskCacheSize()*64;
qDebug() << "Using a disk cache size of" << pref.diskCacheSize() << "MiB";
// Disable OS cache to avoid memory problems (uTorrent behavior)
#ifdef Q_WS_WIN
// Fixes huge memory usage on Windows 7 (especially when checking files)
sessionSettings.disk_io_write_mode = session_settings::disable_os_cache;
sessionSettings.disk_io_read_mode = session_settings::disable_os_cache;
#endif
// Disabling the OS disk cache is intended to reduce memory usage (especially when checking files) but might be unreliable
sessionSettings.disk_io_write_mode = pref.disableOSWriteCache() ? session_settings::disable_os_cache : session_settings::enable_os_cache;
sessionSettings.disk_io_read_mode = pref.disableOSReadCache() ? session_settings::disable_os_cache : session_settings::enable_os_cache;
#if LIBTORRENT_VERSION_MINOR > 15
sessionSettings.anonymous_mode = pref.isAnonymousModeEnabled();
if (sessionSettings.anonymous_mode) {