From 86eb6df05c7f72c63384c1df27f456f87bdaf6f0 Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Mon, 9 Oct 2023 20:22:04 -0300 Subject: [PATCH] vulkan: don't hold onto ImageData references after loading an image. Reduces CPU memory usage. --- src/modules/graphics/vulkan/Texture.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/graphics/vulkan/Texture.cpp b/src/modules/graphics/vulkan/Texture.cpp index 6ae53c1c1..8a979789c 100644 --- a/src/modules/graphics/vulkan/Texture.cpp +++ b/src/modules/graphics/vulkan/Texture.cpp @@ -41,6 +41,10 @@ Texture::Texture(love::graphics::Graphics *gfx, const Settings &settings, const slices = *data; loadVolatile(); + + // ImageData is referenced by the first loadVolatile call, but we don't + // hang on to it after that so we can save memory. + slices.clear(); } bool Texture::loadVolatile()