I noticed that image widgets in some cases can cause huge space leaks when they are requested to be rendered every frame (e.g. during an animation). I made an example where image widgets switch places and immediately an animation starts which leads to big increase of RAM usage:
I believe it happens here because when they switch places, during the subsequent merge each image disposes of the image data, sending the requests to remove the image from the renderer, and then immediately the other image widget resends the image data to the renderer causing some space leak. Although, I don't know why it uses SO much memory (2.4 GB after several animation iterations), when the images of these red buttons are about 100 KB (probably they get bigger when converted to ByteString?).
So, I added the config option to the image called "noDispose", so that image widget won't send dispose requests during the merge and it helped:
I noticed that image widgets in some cases can cause huge space leaks when they are requested to be rendered every frame (e.g. during an animation). I made an example where image widgets switch places and immediately an animation starts which leads to big increase of RAM usage:
https://github.com/fjvallarino/monomer/assets/26405676/61850e2e-fd0c-4038-8635-3ea3b602bca7
I believe it happens here because when they switch places, during the subsequent merge each image disposes of the image data, sending the requests to remove the image from the renderer, and then immediately the other image widget resends the image data to the renderer causing some space leak. Although, I don't know why it uses SO much memory (2.4 GB after several animation iterations), when the images of these red buttons are about 100 KB (probably they get bigger when converted to ByteString?).
So, I added the config option to the image called "noDispose", so that image widget won't send dispose requests during the merge and it helped:
https://github.com/fjvallarino/monomer/assets/26405676/c02e1f44-2fdf-4009-92c6-bcb54c9a8a3f
The code of the dev-test-app illustrating the described behavior:
https://github.com/Deltaspace0/monomer/blob/memleak-example/dev-test-app/Main.hs
If you remove the "noDispose" config, the app will consume a lot of memory during animations.