To test this change, run a nested instance of Sway; inside it, run swaybg -i image.jpg -m tile; and then resize the nested Sway several times, and watch its memory usage. Before this change, every time the frame was redrawn, a copy of the pixel data for image.jpg would be leaked; for large images, this can be a few hundred MB, every time.
This fixes a significant memory leak which occurs when using the
tile
image scaling mode; it was brought to my attention by https://github.com/swaywm/swaybg/issues/14#issuecomment-1059096139 .To test this change, run a nested instance of Sway; inside it, run
swaybg -i image.jpg -m tile
; and then resize the nested Sway several times, and watch its memory usage. Before this change, every time the frame was redrawn, a copy of the pixel data for image.jpg would be leaked; for large images, this can be a few hundred MB, every time.