Make working set limit available only on libtorrent 2.0.x builds

You can already control the cache size in libtorrent 1.2.x so it doesn't make sense to implement this limit for all use cases. Also there are some downsides to using working set size to limit memory usage such as unresponsive GUI when limit gets hit.
This commit is contained in:
summer
2022-06-26 10:26:21 +06:00
committed by Chocobo1
parent b760f37093
commit c7daaf95fc
4 changed files with 14 additions and 4 deletions

View File

@@ -220,7 +220,9 @@ void Application::setMemoryWorkingSetLimit(const int size)
return;
m_storeMemoryWorkingSetLimit = size;
#ifdef QBT_USES_LIBTORRENT2
applyMemoryWorkingSetLimit();
#endif
}
#endif
@@ -621,7 +623,7 @@ void Application::processParams(const QStringList &params)
int Application::exec(const QStringList &params)
{
#ifdef Q_OS_WIN
#if (defined(Q_OS_WIN) && defined(QBT_USES_LIBTORRENT2))
applyMemoryWorkingSetLimit();
#endif
@@ -794,7 +796,7 @@ void Application::shutdownCleanup(QSessionManager &manager)
}
#endif
#ifdef Q_OS_WIN
#if (defined(Q_OS_WIN) && defined(QBT_USES_LIBTORRENT2))
void Application::applyMemoryWorkingSetLimit()
{
const SIZE_T UNIT_SIZE = 1024 * 1024; // MiB