Commit 295435d8 authored by Martin Tobias Holmedahl Sandsmark's avatar Martin Tobias Holmedahl Sandsmark Committed by Tomaz Canabrava
Browse files

Make sure we release memory when clearing the (possibly huge) scroll history

parent e7d93d90
Pipeline #97847 passed with stage
in 1 minute and 52 seconds
......@@ -27,6 +27,13 @@
#include "profile/Profile.h"
#include "profile/ProfileManager.h"
// For malloc_trim, which is a GNU extension
#ifdef __GNUC__
extern "C" {
#include <malloc.h>
}
#endif
using namespace Konsole;
// Macro to convert x,y position on screen to position within an image.
......@@ -1693,6 +1700,11 @@ void Screen::setScroll(const HistoryType &t, bool copyPreviousScroll)
auto oldHistory = std::move(_history);
t.scroll(_history);
}
#ifdef __GNUC__
// We might have been using gigabytes of memory, so make sure it is actually released
malloc_trim(0);
#endif
}
bool Screen::hasScroll() const
......
  • Konsole::Screen::clearImage > std::fill is occasionally (after a few minutes of use) segfaulting after a recent commit (possibly not this commit). See https://bugs.kde.org/show_bug.cgi?id=445550 .

  • This brakes the build on macos

    konsole/src/Screen.cpp:33:10: fatal error: 'malloc.h' file not found

  • @sysadmin is it possible to add macOS on the ci?

    Kurt, can you add a ifdef for Linux ?

Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment