From 7f7af8d4a0ce05dc68348fad1b9ee21bf9c27e70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hejl?= Date: Fri, 28 Jan 2022 09:39:55 +0100 Subject: [PATCH] Suppressed reports of memory leaks from libfontconfig, libfreetype, and some GPU drivers. --- src/PrusaSlicer.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/PrusaSlicer.cpp b/src/PrusaSlicer.cpp index 3d2e6e6b7..78e3623d9 100644 --- a/src/PrusaSlicer.cpp +++ b/src/PrusaSlicer.cpp @@ -823,6 +823,26 @@ std::string CLI::output_filepath(const Model &model, IO::ExportFormat format) co return proposed_path.string(); } +// __has_feature() is used later for Clang, this is for compatibility with other compilers (such as GCC and MSVC) +#ifndef __has_feature +# define __has_feature(x) 0 +#endif + +#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) +extern "C" { + // Based on https://github.com/google/skia/blob/main/tools/LsanSuppressions.cpp + const char *__lsan_default_suppressions() { + return "leak:libfontconfig\n" // FontConfig looks like it leaks, but it doesn't. + "leak:libfreetype\n" // Unsure, appeared upgrading Debian 9->10. + "leak:libGLX_nvidia.so\n" // For NVidia driver. + "leak:libnvidia-glcore.so\n" // For NVidia driver. + "leak:libnvidia-tls.so\n" // For NVidia driver. + "leak:terminator_CreateDevice\n" // For Intel Vulkan drivers. + ; + } +} +#endif + #if defined(_MSC_VER) || defined(__MINGW32__) extern "C" { __declspec(dllexport) int __stdcall slic3r_main(int argc, wchar_t **argv)