Memory leak in SWT
There seems to be a memory leak in the pillowfight.swt function. A minimal reproduction:
import pillowfight
import PIL.Image
def test_swt_memleak():
img_path = 'test_img.png'
img = PIL.Image.open(img_path)
print(img.size)
print(img.mode)
i = 0
while True:
pillowfight.swt(img)
i += 1
print(i)
if __name__ == '__main__':
test_swt_memleak()
Running above code and observing memory usage in top or htop reveals that the memory usage keeps growing. I have tested this code given a colored png image with dimensions (960, 540).