gpu: Do a GC run after every tile of large images

When we draw large images, we absolutely do not want to keep memory that
we do not need. So do a GC run after every tile. That otentially slows
down things, but it also improves the chances of not running out of
memory.

Here's the node for the image I managed to create after I applied this
patch:

repeat {
  bounds: 0 0 50000 50000;
  child: text {
    font: "Noto Color Emoji 10000px";
    glyphs: 661 0 0 0 color;
    offset: 0 10000;
    hint-style: none;
  }
}
This commit is contained in:
Benjamin Otte 2024-07-12 10:07:21 +02:00
parent 0516dca116
commit d0f8ef09a0

View File

@ -326,6 +326,9 @@ gsk_gpu_renderer_fallback_render_texture (GskGpuRenderer *self,
gdk_texture_downloader_finish (&downloader);
g_object_unref (texture);
g_clear_object (&image);
/* Let's GC like a madman, we draw oversized stuff and don't want to OOM */
gsk_gpu_device_maybe_gc (priv->device);
}
}