diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index 96dedabb8..0801e2f66 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -59,9 +59,13 @@ namespace Slic3r { time = 0.0f; prepare_time = 0.0f; custom_gcode_times.clear(); + custom_gcode_times.shrink_to_fit(); moves_times.clear(); + moves_times.shrink_to_fit(); roles_times.clear(); + roles_times.shrink_to_fit(); layers_times.clear(); + layers_times.shrink_to_fit(); } }; @@ -81,6 +85,7 @@ namespace Slic3r { m.reset(); } volumes_per_color_change.clear(); + volumes_per_color_change.shrink_to_fit(); volumes_per_extruder.clear(); flush_per_filament.clear(); used_filaments_per_role.clear(); diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index d749561d7..d2854940c 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -176,7 +176,9 @@ void GCodeViewer::InstanceVBuffer::Ranges::reset() void GCodeViewer::InstanceVBuffer::reset() { s_ids.clear(); + s_ids.shrink_to_fit(); buffer.clear(); + buffer.shrink_to_fit(); render_ranges.reset(); } @@ -1222,6 +1224,7 @@ void GCodeViewer::reset() m_moves_count = 0; m_ssid_to_moveid_map.clear(); + m_ssid_to_moveid_map.shrink_to_fit(); for (TBuffer& buffer : m_buffers) { buffer.reset(); } diff --git a/src/slic3r/GUI/GCodeViewer.hpp b/src/slic3r/GUI/GCodeViewer.hpp index e8f83e7c6..7bb19d6fe 100644 --- a/src/slic3r/GUI/GCodeViewer.hpp +++ b/src/slic3r/GUI/GCodeViewer.hpp @@ -666,8 +666,11 @@ public: void reset() { stop_mapping_file(); m_lines_ends.clear(); + m_lines_ends.shrink_to_fit(); m_lines.clear(); + m_lines.shrink_to_fit(); m_filename.clear(); + m_filename.shrink_to_fit(); } void toggle_visibility() { m_visible = !m_visible; }