mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-06 05:01:25 -07:00
Remove "Physical memory (RAM) usage limit" option on Linux
Memory working set limit is not effective on Linux at all. See [`getrlimit(2)`](https://man7.org/linux/man-pages/man2/getrlimit.2.html) → `RLIMIT_RSS`. Introduced in #16874, disabled for macOS in #19805. This PR hides the option for Linux too. Worth to mention that #19805 did not deliver the change for WebUI. So there is also a small fixup, I covered both cases. Also removed pointless "This option is less effective on Linux" remark. PR #22680.
This commit is contained in:
parent
de767871f1
commit
b79ac0d716
4 changed files with 11 additions and 9 deletions
|
@ -410,7 +410,7 @@ void Application::setMemoryWorkingSetLimit(const int size)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_storeMemoryWorkingSetLimit = size;
|
m_storeMemoryWorkingSetLimit = size;
|
||||||
#if defined(QBT_USES_LIBTORRENT2) && !defined(Q_OS_MACOS)
|
#if defined(QBT_USES_LIBTORRENT2) && !defined(Q_OS_LINUX) && !defined(Q_OS_MACOS)
|
||||||
applyMemoryWorkingSetLimit();
|
applyMemoryWorkingSetLimit();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -844,7 +844,7 @@ int Application::exec()
|
||||||
printf("%s\n", qUtf8Printable(loadingStr));
|
printf("%s\n", qUtf8Printable(loadingStr));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(QBT_USES_LIBTORRENT2) && !defined(Q_OS_MACOS)
|
#if defined(QBT_USES_LIBTORRENT2) && !defined(Q_OS_LINUX) && !defined(Q_OS_MACOS)
|
||||||
applyMemoryWorkingSetLimit();
|
applyMemoryWorkingSetLimit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1202,7 +1202,7 @@ void Application::shutdownCleanup([[maybe_unused]] QSessionManager &manager)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(QBT_USES_LIBTORRENT2) && !defined(Q_OS_MACOS)
|
#if defined(QBT_USES_LIBTORRENT2) && !defined(Q_OS_LINUX) && !defined(Q_OS_MACOS)
|
||||||
void Application::applyMemoryWorkingSetLimit() const
|
void Application::applyMemoryWorkingSetLimit() const
|
||||||
{
|
{
|
||||||
const size_t MiB = 1024 * 1024;
|
const size_t MiB = 1024 * 1024;
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace
|
||||||
QBITTORRENT_HEADER,
|
QBITTORRENT_HEADER,
|
||||||
RESUME_DATA_STORAGE,
|
RESUME_DATA_STORAGE,
|
||||||
TORRENT_CONTENT_REMOVE_OPTION,
|
TORRENT_CONTENT_REMOVE_OPTION,
|
||||||
#if defined(QBT_USES_LIBTORRENT2) && !defined(Q_OS_MACOS)
|
#if defined(QBT_USES_LIBTORRENT2) && !defined(Q_OS_LINUX) && !defined(Q_OS_MACOS)
|
||||||
MEMORY_WORKING_SET_LIMIT,
|
MEMORY_WORKING_SET_LIMIT,
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
|
@ -209,7 +209,7 @@ void AdvancedSettings::saveAdvancedSettings() const
|
||||||
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
||||||
|
|
||||||
session->setResumeDataStorageType(m_comboBoxResumeDataStorage.currentData().value<BitTorrent::ResumeDataStorageType>());
|
session->setResumeDataStorageType(m_comboBoxResumeDataStorage.currentData().value<BitTorrent::ResumeDataStorageType>());
|
||||||
#if defined(QBT_USES_LIBTORRENT2) && !defined(Q_OS_MACOS)
|
#if defined(QBT_USES_LIBTORRENT2) && !defined(Q_OS_LINUX) && !defined(Q_OS_MACOS)
|
||||||
// Physical memory (RAM) usage limit
|
// Physical memory (RAM) usage limit
|
||||||
app()->setMemoryWorkingSetLimit(m_spinBoxMemoryWorkingSetLimit.value());
|
app()->setMemoryWorkingSetLimit(m_spinBoxMemoryWorkingSetLimit.value());
|
||||||
#endif
|
#endif
|
||||||
|
@ -494,12 +494,11 @@ void AdvancedSettings::loadAdvancedSettings()
|
||||||
m_comboBoxTorrentContentRemoveOption.setCurrentIndex(m_comboBoxTorrentContentRemoveOption.findData(QVariant::fromValue(session->torrentContentRemoveOption())));
|
m_comboBoxTorrentContentRemoveOption.setCurrentIndex(m_comboBoxTorrentContentRemoveOption.findData(QVariant::fromValue(session->torrentContentRemoveOption())));
|
||||||
addRow(TORRENT_CONTENT_REMOVE_OPTION, tr("Torrent content removing mode"), &m_comboBoxTorrentContentRemoveOption);
|
addRow(TORRENT_CONTENT_REMOVE_OPTION, tr("Torrent content removing mode"), &m_comboBoxTorrentContentRemoveOption);
|
||||||
|
|
||||||
#if defined(QBT_USES_LIBTORRENT2) && !defined(Q_OS_MACOS)
|
#if defined(QBT_USES_LIBTORRENT2) && !defined(Q_OS_LINUX) && !defined(Q_OS_MACOS)
|
||||||
// Physical memory (RAM) usage limit
|
// Physical memory (RAM) usage limit
|
||||||
m_spinBoxMemoryWorkingSetLimit.setMinimum(1);
|
m_spinBoxMemoryWorkingSetLimit.setMinimum(1);
|
||||||
m_spinBoxMemoryWorkingSetLimit.setMaximum(std::numeric_limits<int>::max());
|
m_spinBoxMemoryWorkingSetLimit.setMaximum(std::numeric_limits<int>::max());
|
||||||
m_spinBoxMemoryWorkingSetLimit.setSuffix(tr(" MiB"));
|
m_spinBoxMemoryWorkingSetLimit.setSuffix(tr(" MiB"));
|
||||||
m_spinBoxMemoryWorkingSetLimit.setToolTip(tr("This option is less effective on Linux"));
|
|
||||||
m_spinBoxMemoryWorkingSetLimit.setValue(app()->memoryWorkingSetLimit());
|
m_spinBoxMemoryWorkingSetLimit.setValue(app()->memoryWorkingSetLimit());
|
||||||
addRow(MEMORY_WORKING_SET_LIMIT, (tr("Physical memory (RAM) usage limit") + u' ' + makeLink(u"https://wikipedia.org/wiki/Working_set", u"(?)"))
|
addRow(MEMORY_WORKING_SET_LIMIT, (tr("Physical memory (RAM) usage limit") + u' ' + makeLink(u"https://wikipedia.org/wiki/Working_set", u"(?)"))
|
||||||
, &m_spinBoxMemoryWorkingSetLimit);
|
, &m_spinBoxMemoryWorkingSetLimit);
|
||||||
|
|
|
@ -93,7 +93,7 @@ private:
|
||||||
QSpinBox m_spinBoxHashingThreads;
|
QSpinBox m_spinBoxHashingThreads;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(QBT_USES_LIBTORRENT2) && !defined(Q_OS_MACOS)
|
#if defined(QBT_USES_LIBTORRENT2) && !defined(Q_OS_LINUX) && !defined(Q_OS_MACOS)
|
||||||
QSpinBox m_spinBoxMemoryWorkingSetLimit;
|
QSpinBox m_spinBoxMemoryWorkingSetLimit;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1159,7 +1159,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
<label for="memoryWorkingSetLimit">QBT_TR(Physical memory (RAM) usage limit:)QBT_TR[CONTEXT=OptionsDialog] <a href="https://wikipedia.org/wiki/Working_set" target="_blank">(?)</a></label>
|
<label for="memoryWorkingSetLimit">QBT_TR(Physical memory (RAM) usage limit:)QBT_TR[CONTEXT=OptionsDialog] <a href="https://wikipedia.org/wiki/Working_set" target="_blank">(?)</a></label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" id="memoryWorkingSetLimit" style="width: 15em;" title="QBT_TR(This option is less effective on Linux)QBT_TR[CONTEXT=OptionsDialog]"> QBT_TR(MiB)QBT_TR[CONTEXT=OptionsDialog]
|
<input type="text" id="memoryWorkingSetLimit" style="width: 15em;"> QBT_TR(MiB)QBT_TR[CONTEXT=OptionsDialog]
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -3164,6 +3164,9 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
document.getElementById("diskIOWriteModeWriteThrough").style.display = "none";
|
document.getElementById("diskIOWriteModeWriteThrough").style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((buildInfo.platform === "linux") || (buildInfo.platform === "macos"))
|
||||||
|
document.getElementById("rowMemoryWorkingSetLimit").style.display = "none";
|
||||||
|
|
||||||
if ((buildInfo.platform !== "macos") && (buildInfo.platform !== "windows"))
|
if ((buildInfo.platform !== "macos") && (buildInfo.platform !== "windows"))
|
||||||
document.getElementById("rowMarkOfTheWeb").style.display = "none";
|
document.getElementById("rowMarkOfTheWeb").style.display = "none";
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue