diff --git a/.gitmodules b/.gitmodules index f982f14b8..80bc6b96d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -91,3 +91,6 @@ [submodule "Telegram/lib_webview"] path = Telegram/lib_webview url = https://github.com/desktop-app/lib_webview.git +[submodule "Telegram/ThirdParty/mallocng"] + path = Telegram/ThirdParty/mallocng + url = https://github.com/desktop-app/mallocng.git diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index cd620a43a..d3193cb90 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -89,6 +89,7 @@ elseif (LINUX) PRIVATE desktop-app::external_glibmm desktop-app::external_glib + desktop-app::external_mallocng ) if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 498b37372..6bc833ac0 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -59,6 +59,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include #include +#include #include @@ -745,6 +746,16 @@ int psFixPrevious() { namespace Platform { void start() { + // avoid stripping custom allocator + malloc(0); + calloc(0, 0); + realloc(nullptr, 0); + free(nullptr); + aligned_alloc(0, 0); + malloc_usable_size(nullptr); + memalign(0, 0); + posix_memalign(nullptr, 0, 0); + LOG(("Launcher filename: %1").arg(QGuiApplication::desktopFileName())); qputenv("PULSE_PROP_application.name", AppName.utf8()); diff --git a/Telegram/ThirdParty/mallocng b/Telegram/ThirdParty/mallocng new file mode 160000 index 000000000..5db0b72cd --- /dev/null +++ b/Telegram/ThirdParty/mallocng @@ -0,0 +1 @@ +Subproject commit 5db0b72cd85b20aec790fccdd31c17111afc7c94 diff --git a/cmake b/cmake index 1720a174c..5318ac7c5 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 1720a174c4d96bc1512837adcae257c6637438e5 +Subproject commit 5318ac7c54dbf33b17ccc4bd3281bb8b8db25e02