[gnome-software/1154-should-we-call-malloc_trim-0] gs-shell: Free unused memory on the main window close



commit a2bb2b8e8cc8eac5336fc54aec8f306dd963bf5c
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jan 20 15:52:03 2022 +0100

    gs-shell: Free unused memory on the main window close
    
    Let the unused heap memory being freed to release RSS memory used
    by the process when the main window is closed (and hidden in the background).
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1154

 src/gs-shell.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 0ff933c3a..939434f3d 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -11,6 +11,7 @@
 #include "config.h"
 
 #include <adwaita.h>
+#include <malloc.h>
 #include <string.h>
 #include <glib/gi18n.h>
 
@@ -1054,6 +1055,10 @@ main_window_closed_cb (GtkWidget *dialog, gpointer user_data)
 
        gs_shell_clean_back_entry_stack (shell);
        gtk_widget_hide (dialog);
+
+       /* Free unused memory */
+       malloc_trim (0);
+
        return TRUE;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]