diff options
Diffstat (limited to 'net-im/telegram-desktop/files/tdesktop-3.5.2-jemalloc-optional.patch')
-rw-r--r-- | net-im/telegram-desktop/files/tdesktop-3.5.2-jemalloc-optional.patch | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/net-im/telegram-desktop/files/tdesktop-3.5.2-jemalloc-optional.patch b/net-im/telegram-desktop/files/tdesktop-3.5.2-jemalloc-optional.patch new file mode 100644 index 000000000000..bd3595858c20 --- /dev/null +++ b/net-im/telegram-desktop/files/tdesktop-3.5.2-jemalloc-optional.patch @@ -0,0 +1,71 @@ +Optionally disable jemalloc + +Telegram upstream heavily insists you use the jemalloc allocator. This is due +to the high memory usage resulting from the glibc allocator. It is unknown why +this affects telegram the way it does, but upstream solved the issue by using a +different allocator. Initially they used mallocng, now jemalloc. + +However, other libcs don't necessarily need this, and as such this should be +optional. As mallocng is a fork of musl's allocator, and this was used before +the switch to jemalloc, the musl allocator should still be OK. + +Please warn glibc users about disabling jemalloc, don't report bugs about +memory usage upstream unless you're using jemalloc. + +Related info: +https://github.com/telegramdesktop/tdesktop/issues/16084 +https://github.com/desktop-app/cmake_helpers/pull/91#issuecomment-881788003 + +--- tdesktop-3.5.2-full.orig/Telegram/CMakeLists.txt ++++ tdesktop-3.5.2-full/Telegram/CMakeLists.txt +@@ -1358,11 +1358,13 @@ + ) + endif() + +- target_link_libraries(Telegram +- PRIVATE +- desktop-app::linux_jemalloc_helper +- $<TARGET_OBJECTS:desktop-app::linux_jemalloc_helper> +- ) ++ if (NOT DESKTOP_APP_DISABLE_JEMALLOC) ++ target_link_libraries(Telegram ++ PRIVATE ++ desktop-app::linux_jemalloc_helper ++ $<TARGET_OBJECTS:desktop-app::linux_jemalloc_helper> ++ ) ++ endif() + endif() + + if (build_macstore) +--- tdesktop-3.5.2-full.orig/cmake/CMakeLists.txt ++++ tdesktop-3.5.2-full/cmake/CMakeLists.txt +@@ -5,7 +5,7 @@ + # https://github.com/desktop-app/legal/blob/master/LEGAL + + add_subdirectory(external) +-if (LINUX) ++if (LINUX AND NOT DESKTOP_APP_DISABLE_JEMALLOC) + add_subdirectory(linux_jemalloc_helper) + endif() + if (LINUX AND NOT DESKTOP_APP_USE_PACKAGED) +--- tdesktop-3.5.2-full.orig/cmake/external/CMakeLists.txt ++++ tdesktop-3.5.2-full/cmake/external/CMakeLists.txt +@@ -37,7 +37,7 @@ + add_checked_subdirectory(hunspell) + endif() + add_checked_subdirectory(iconv) +-if (LINUX) ++if (LINUX AND NOT DESKTOP_APP_DISABLE_JEMALLOC) + add_checked_subdirectory(jemalloc) + endif() + add_checked_subdirectory(jpeg) +--- tdesktop-3.5.2-full.orig/cmake/variables.cmake ++++ tdesktop-3.5.2-full/cmake/variables.cmake +@@ -26,6 +26,7 @@ + option(DESKTOP_APP_USE_PACKAGED_FONTS "Use preinstalled fonts instead of bundled patched ones." OFF) + option(DESKTOP_APP_USE_PACKAGED_RLOTTIE "Find rlottie using CMake instead of bundled patched one." OFF) + option(DESKTOP_APP_DISABLE_SPELLCHECK "Disable spellcheck library." OFF) ++option(DESKTOP_APP_DISABLE_JEMALLOC "Disable use of the jemalloc allocator (Linux only)." OFF) + option(DESKTOP_APP_DISABLE_CRASH_REPORTS "Disable crash report generation." ${no_special_target}) + option(DESKTOP_APP_DISABLE_AUTOUPDATE "Disable autoupdate." ${disable_autoupdate}) + option(DESKTOP_APP_USE_HUNSPELL_ONLY "Disable system spellchecker and use bundled Hunspell only. (For debugging purposes)" OFF) |