https://bugs.kde.org/show_bug.cgi?id=431945

--- Comment #3 from mourgos <papazoglou.anes...@gmail.com> ---
I managed to find some free time to investigate this and I believe I have found
the cause of the issue, and it isn't a memory leak but rather an (unforseen?)
change in behaviour.

Looking at the history, I think the culprit is this commit:
https://invent.kde.org/graphics/krita/-/commit/b8b657d2ebf323a2007e870950c131ce5ee1e6f9.
In order to have higher resolution images to display,
comics_project_manager_docker.fill_pages() was changed to read the
mergedimage.png rather than preview.png.

The problem is, that when loaded in memory (and as such decompressed), a merged
image can take a significant amount of RAM. In my case, that's ~130MiB per
file. Given that a comic/graphic novel has dozens of images, this quickly
balloons to multiple gigabytes of ram just for page previews. Unsurprisingly,
loading that many big images also takes a lot of time, which causes the delay I
described before.

I think this can be seen as a regression in functionality, as it uses up
valuable RAM that would be otherwise be used for actual drawing. If the comic
book is large enough, it might even exhaust all of the available RAM just by
opening the project json file!

In terms of solutions to this, I see two possible avenues to fix this:
1) Revert back to the old behaviour of loading preview.png instead of
mergedimage.png. This will fix the memory/loading time issues, but will lead to
smaller page previews (in my opinion not a huge issue).
2) Alternatively, if larger size page previews are a necessity, the mergedimage
could be resized on the fly to something smaller before being used as an icon.
This would make memory usage more sensible without sacrificing much in terms of
visual quality, but it would increase the loading time even more given that we
now would need to also resize multiple large images.

Any thoughts on this? This might be a niche of a bug, but it prevents me from
upgrading from 4.4.1, so I'd be more than willing to propose an MR if you are
happy with one of the two options :)

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to