mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
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:
parent
6d03666d2d
commit
f94e32037c
@ -132,3 +132,6 @@
|
|||||||
|
|
||||||
/* Supports timerfd_create/timerfd_settime */
|
/* Supports timerfd_create/timerfd_settime */
|
||||||
#mesondefine HAVE_TIMERFD
|
#mesondefine HAVE_TIMERFD
|
||||||
|
|
||||||
|
/* Supports malloc_trim */
|
||||||
|
#mesondefine HAVE_MALLOC_TRIM
|
||||||
|
@ -345,6 +345,8 @@ int main (int argc, char ** argv) {
|
|||||||
}
|
}
|
||||||
''', name : 'timerfd_create(2) system call')
|
''', name : 'timerfd_create(2) system call')
|
||||||
|
|
||||||
|
have_malloc_trim = meson.get_compiler('c').has_function('malloc_trim')
|
||||||
|
|
||||||
have_documentation = get_option('docs')
|
have_documentation = get_option('docs')
|
||||||
have_tests = get_option('tests')
|
have_tests = get_option('tests')
|
||||||
have_core_tests = false
|
have_core_tests = false
|
||||||
@ -570,6 +572,7 @@ cdata.set('HAVE_PROFILER', have_profiler)
|
|||||||
cdata.set('HAVE_LIBDISPLAY_INFO', have_libdisplay_info)
|
cdata.set('HAVE_LIBDISPLAY_INFO', have_libdisplay_info)
|
||||||
cdata.set('HAVE_PANGO_FT2', have_pango_ft2)
|
cdata.set('HAVE_PANGO_FT2', have_pango_ft2)
|
||||||
cdata.set('HAVE_TIMERFD', have_timerfd)
|
cdata.set('HAVE_TIMERFD', have_timerfd)
|
||||||
|
cdata.set('HAVE_MALLOC_TRIM', have_malloc_trim)
|
||||||
|
|
||||||
if have_x11_client
|
if have_x11_client
|
||||||
xkb_base = xkeyboard_config_dep.get_variable('xkb_base')
|
xkb_base = xkeyboard_config_dep.get_variable('xkb_base')
|
||||||
|
@ -23,6 +23,10 @@
|
|||||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_MALLOC_TRIM
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "clutter/clutter.h"
|
#include "clutter/clutter.h"
|
||||||
#include "compositor/cogl-utils.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);
|
pixbuf = gdk_pixbuf_new_from_stream (G_INPUT_STREAM (stream), NULL, &error);
|
||||||
g_object_unref (stream);
|
g_object_unref (stream);
|
||||||
|
|
||||||
|
#ifdef HAVE_MALLOC_TRIM
|
||||||
|
malloc_trim (0);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pixbuf == NULL)
|
if (pixbuf == NULL)
|
||||||
{
|
{
|
||||||
g_task_return_error (task, error);
|
g_task_return_error (task, error);
|
||||||
|
Loading…
Reference in New Issue
Block a user