Call malloc_trim after loading images
Not sure this is the best place to do it, but at least it is one place where we tend to do large, temporary allocations.
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include <jpeglib.h>
|
||||
#include <jerror.h>
|
||||
#include <setjmp.h>
|
||||
#include <malloc.h>
|
||||
|
||||
/* {{{ Error handling */
|
||||
|
||||
@@ -237,8 +238,10 @@ gdk_load_jpeg (GBytes *input_bytes,
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
malloc_trim (0);
|
||||
|
||||
gdk_profiler_end_mark (before, "Load jpeg", NULL);
|
||||
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "gsk/gl/fp16private.h"
|
||||
#include <png.h>
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
|
||||
/* The main difference between the png load/save code here and
|
||||
* gdk-pixbuf is that we can support loading 16-bit data in the
|
||||
@@ -300,6 +301,8 @@ gdk_load_png (GBytes *bytes,
|
||||
g_free (row_pointers);
|
||||
png_destroy_read_struct (&png, &info, NULL);
|
||||
|
||||
malloc_trim (0);
|
||||
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
{
|
||||
gint64 end = GDK_PROFILER_CURRENT_TIME;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "gdktexturedownloaderprivate.h"
|
||||
|
||||
#include <tiffio.h>
|
||||
#include <malloc.h>
|
||||
|
||||
/* Our main interest in tiff as an image format is that it is
|
||||
* flexible enough to save all our texture formats without
|
||||
@@ -500,6 +501,8 @@ gdk_load_tiff (GBytes *input_bytes,
|
||||
|
||||
TIFFClose (tif);
|
||||
|
||||
malloc_trim (0);
|
||||
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
{
|
||||
gint64 end = GDK_PROFILER_CURRENT_TIME;
|
||||
|
||||
Reference in New Issue
Block a user