background: Call malloc_trim() after loading background image
Some of the new JXL backgrounds from gnome-backgrounds can allocate several hundred MB during loading, so let's call malloc_trim() after we are done with loading the image into a pixbuf. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3327 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3653>
This commit is contained in:

committed by
Marge Bot

parent
6d03666d2d
commit
f94e32037c
@ -23,6 +23,10 @@
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#ifdef HAVE_MALLOC_TRIM
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter.h"
|
||||
#include "compositor/cogl-utils.h"
|
||||
|
||||
@ -135,6 +139,10 @@ load_file (GTask *task,
|
||||
pixbuf = gdk_pixbuf_new_from_stream (G_INPUT_STREAM (stream), NULL, &error);
|
||||
g_object_unref (stream);
|
||||
|
||||
#ifdef HAVE_MALLOC_TRIM
|
||||
malloc_trim (0);
|
||||
#endif
|
||||
|
||||
if (pixbuf == NULL)
|
||||
{
|
||||
g_task_return_error (task, error);
|
||||
|
Reference in New Issue
Block a user