From 7cc4b1d8b49f89c57702375972812d7bf539f4f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hejl?= Date: Sat, 5 Feb 2022 13:26:52 +0100 Subject: [PATCH 1/2] Suppressed reports of memory leaks from Mesa 3D software driver in WSLg. --- src/PrusaSlicer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/PrusaSlicer.cpp b/src/PrusaSlicer.cpp index 5bde6c128..4483d6010 100644 --- a/src/PrusaSlicer.cpp +++ b/src/PrusaSlicer.cpp @@ -836,6 +836,7 @@ extern "C" { "leak:libnvidia-glcore.so\n" // For NVidia driver. "leak:libnvidia-tls.so\n" // For NVidia driver. "leak:terminator_CreateDevice\n" // For Intel Vulkan drivers. + "leak:swrast_dri.so\n" // For Mesa 3D software driver. ; } } From dd3964c8c3f290c689a342536c7353f865f2a936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hejl?= Date: Sat, 5 Feb 2022 13:27:54 +0100 Subject: [PATCH 2/2] Added deallocation of SupportLayers (PrintObject::m_support_layers) into the PrintObject destructor and fixed memory leak in modulate_extrusion_by_overlapping_layers(). --- src/libslic3r/Print.hpp | 3 ++- src/libslic3r/SupportMaterial.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/Print.hpp b/src/libslic3r/Print.hpp index b6e4802bb..c5e312a2b 100644 --- a/src/libslic3r/Print.hpp +++ b/src/libslic3r/Print.hpp @@ -346,10 +346,11 @@ private: friend class Print; PrintObject(Print* print, ModelObject* model_object, const Transform3d& trafo, PrintInstances&& instances); - ~PrintObject() { + ~PrintObject() override { if (m_shared_regions && --m_shared_regions->m_ref_cnt == 0) delete m_shared_regions; clear_layers(); + clear_support_layers(); } void config_apply(const ConfigBase &other, bool ignore_nonexistent = false) { m_config.apply(other, ignore_nonexistent); } diff --git a/src/libslic3r/SupportMaterial.cpp b/src/libslic3r/SupportMaterial.cpp index 67bd2639b..195fc9e17 100644 --- a/src/libslic3r/SupportMaterial.cpp +++ b/src/libslic3r/SupportMaterial.cpp @@ -3754,6 +3754,7 @@ void modulate_extrusion_by_overlapping_layers( assert(path != nullptr); polylines.emplace_back(Polyline(std::move(path->polyline))); path_ends.emplace_back(std::pair(polylines.back().points.front(), polylines.back().points.back())); + delete path; } } // Destroy the original extrusion paths, their polylines were moved to path_fragments already.