diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 243aa514cd..9d166805a5 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -2602,16 +2602,13 @@ void GCodeProcessorResult::reset() { //BBS: add mutex for protection of gcode result lock(); - // release rather than clear: these two are sized by the print - one entry per move and one - // per g-code line - and a reset is where the memory is expected to go back to the allocator - // (see BackgroundSlicingProcess::apply()). The capacity would not be reused anyway: the - // result is refilled by move-assigning the processor's own result. - moves = std::vector(); + // moves and lines_ends grow with the print: free them, as no reset result reuses the capacity. + clear_and_shrink(moves); plate_mass = {}; object_masses.clear(); body_masses.clear(); support_masses.clear(); - lines_ends = std::vector(); + clear_and_shrink(lines_ends); printable_area = Pointfs(); //BBS: add bed exclude area bed_exclude_area = Pointfs();