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:
Hanabishi
2025-05-12 21:49:18 +05:00
committed by GitHub
parent de767871f1
commit b79ac0d716
4 changed files with 11 additions and 9 deletions

View File

@@ -64,7 +64,7 @@ namespace
QBITTORRENT_HEADER,
RESUME_DATA_STORAGE,
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,
#endif
#if defined(Q_OS_WIN)
@@ -209,7 +209,7 @@ void AdvancedSettings::saveAdvancedSettings() const
BitTorrent::Session *const session = BitTorrent::Session::instance();
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
app()->setMemoryWorkingSetLimit(m_spinBoxMemoryWorkingSetLimit.value());
#endif
@@ -494,12 +494,11 @@ void AdvancedSettings::loadAdvancedSettings()
m_comboBoxTorrentContentRemoveOption.setCurrentIndex(m_comboBoxTorrentContentRemoveOption.findData(QVariant::fromValue(session->torrentContentRemoveOption())));
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
m_spinBoxMemoryWorkingSetLimit.setMinimum(1);
m_spinBoxMemoryWorkingSetLimit.setMaximum(std::numeric_limits<int>::max());
m_spinBoxMemoryWorkingSetLimit.setSuffix(tr(" MiB"));
m_spinBoxMemoryWorkingSetLimit.setToolTip(tr("This option is less effective on Linux"));
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"(?)"))
, &m_spinBoxMemoryWorkingSetLimit);