1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-25 14:04:23 +00:00

Disable OS cache for aligned files to reduce memory consumption

Code cleanup
This commit is contained in:
Christophe Dumez 2011-02-22 18:02:15 +00:00
parent 54c6ccc087
commit af1dfd41ab

View File

@ -388,6 +388,9 @@ void QBtSession::configureSession() {
#endif #endif
sessionSettings.cache_size = pref.diskCacheSize()*64; sessionSettings.cache_size = pref.diskCacheSize()*64;
qDebug() << "Using a disk cache size of" << pref.diskCacheSize() << "MiB"; qDebug() << "Using a disk cache size of" << pref.diskCacheSize() << "MiB";
// Disable OS cache to avoid memory problems (uTorrent behavior)
sessionSettings.disk_io_write_mode = session_settings::disable_os_cache_for_aligned_files;
sessionSettings.disk_io_read_mode = session_settings::disable_os_cache_for_aligned_files;
// Queueing System // Queueing System
if(pref.isQueueingSystemEnabled()) { if(pref.isQueueingSystemEnabled()) {
sessionSettings.active_downloads = pref.getMaxActiveDownloads(); sessionSettings.active_downloads = pref.getMaxActiveDownloads();
@ -2422,11 +2425,6 @@ QString QBtSession::getSavePath(QString hash, bool fromScanDir, QString filePath
savePath = defaultSavePath; savePath = defaultSavePath;
append_root_folder = true; append_root_folder = true;
} }
} else {
QIniSettings settings("qBittorrent", "qBittorrent");
if(!settings.value("ported_to_new_savepath_system", false).toBool()) {
append_root_folder = true;
}
} }
if(!fromScanDir && appendLabelToSavePath) { if(!fromScanDir && appendLabelToSavePath) {
const QString label = TorrentPersistentData::getLabel(hash); const QString label = TorrentPersistentData::getLabel(hash);
@ -2437,9 +2435,7 @@ QString QBtSession::getSavePath(QString hash, bool fromScanDir, QString filePath
} }
if(append_root_folder && !root_folder.isEmpty()) { if(append_root_folder && !root_folder.isEmpty()) {
// Append torrent root folder to the save path // Append torrent root folder to the save path
if(!savePath.endsWith(QDir::separator())) savePath = QDir(savePath).absoluteFilePath(root_folder);
savePath += QDir::separator();
savePath += root_folder;
qDebug("Torrent root folder is %s", qPrintable(root_folder)); qDebug("Torrent root folder is %s", qPrintable(root_folder));
TorrentPersistentData::saveSavePath(hash, savePath); TorrentPersistentData::saveSavePath(hash, savePath);
} }