AVIF leak

*** Please try to reproduce your bug and confirm the bug fix. ***

Moderators: xnview, Dreamer

gyoical
Posts: 14
Joined: Mon Jan 16, 2023 9:13 am

AVIF leak

Post by gyoical »

Forgive me for dragging more on this topic.

Copying dav1d.dll to plugins folder works for me, but there comes another issue: Memory usage. Likely memory leak.

I left XnViewMP to convert about 5,000 files to AVIF. After hundreds (don't remember the exact number) it started to fail then my system was unresponsive because it ran out of ram.

Rebooted the PC and tried to convert again, Saw the exactly same behavior: XnViewMP would eat up all ram gradually during AVIF conversion. The memory was not released after it ended process. It doesn't happen to other formats.
User avatar
xnview
Author of XnView
Posts: 48148
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: AVIF leak

Post by xnview »

with batch convert? there is a leak in AVIF loading, perhaps your problem.
I've sent you a PM
gyoical
Posts: 14
Joined: Mon Jan 16, 2023 9:13 am

Re: AVIF leak

Post by gyoical »

Thank you.

Yes, with batch convert. The test version behaved the same as the old one. To reproduce, try to convert more and large, higher resolution images perhaps?

Maybe it's on me but I don't have other hardware to test on, sorry.

---
I feel like the problem is more obvious when I use my old, ancient config for some reason. It would skyrocket the memory usage instantly. [Sorry, I really don't want to upload my config for inspection. It feels a little intrusive for me, since it has strings of folder/file names, you get the idea. And sorry again I understand you can't help without information.] A fresh one is more subtle, but it still does the same and does not let the ram go when convert a large amount of files.
User avatar
xnview
Author of XnView
Posts: 48148
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: AVIF leak

Post by xnview »

please send me a sample file used, and do you use actions?
gyoical
Posts: 14
Joined: Mon Jan 16, 2023 9:13 am

Re: AVIF leak

Post by gyoical »

No actions enabled.
I have these enabled: Keep original file if result bigger. Rename if already exists. Preserve meta data. Preserve color profile. Multi-core.
Tried to toggle them they didn't seem to matter.

To reproduce maybe try the same tasks multiple times? Repeat this: Start and abort when the memory usage is high then start again. Sorry, I really can't send those files. Anyway, I tested on various files; any images would do the same. It's not like it only happens to specific images.

----
If you can't reproduce on your end, probably it's on me since no one reported similar issues. Thanks for the help, really appreciated it.
User avatar
xnview
Author of XnView
Posts: 48148
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: AVIF leak

Post by xnview »

are you able to reproduce with 1 core, and 20 jpeg files?
gyoical
Posts: 14
Joined: Mon Jan 16, 2023 9:13 am

Re: AVIF leak

Post by gyoical »

After multiple tests, converting JPEGs doesn't seem to do this. But I have a vague memory that happened. Now I'm not sure anymore. :?

It seems to happen to lots of my PNGs and JXLs (Which were converted by XnView MP) Oddly, I downloaded a few more PNGs and it's not like all the PNGs would do this. Multi-core doesn't seem to matter here.

I've attached one image that seems to trigger the issue on my side. The JXL one was converted by XnView MP, and it does the same thing when converting to AVIF.


When it happens I can see those ucrtbase.dll piling up, not killed in threads after the process.
ProcessM.png
I'm no programmer so I have no idea what this is about.


Thanks for the help.
You do not have the required permissions to view the files attached to this post.
gyoical
Posts: 14
Joined: Mon Jan 16, 2023 9:13 am

Re: AVIF leak

Post by gyoical »

I've got more to address, sorry if this is too much a bother. :(

I let XnView MP convert the original PNG to other common formats to test out.
JPG, GIF, PSD to AVIF > No issue.
BMP, WEBP, HEIC, JXL, AVIF, TIF to AVIF > Having the issue.

Just a theory, I think the problem might be on how XnView MP treats those alpha pixels. The problem seems to be always reproducable if an image has alpha pixels, or at least when XnView MP sees one.

The PSD converted by XnView MP doesn't cause the issue. Because in the converted PSD all those translucent pixels turned black. While the PSD file saved by Adobe Photoshop Elements 7 can cause the issue. The same applies to GIF. In the GIF converted by XnView MP, the translucent pixels all turned white. So it doesn't cause the problem.

I've attached different PSD files that in some XnView MP can 'see' translucent pixels and in some it doesn't.


Thanks a lot.
You do not have the required permissions to view the files attached to this post.
gyoical
Posts: 14
Joined: Mon Jan 16, 2023 9:13 am

Re: AVIF leak

Post by gyoical »

:D Yes, it's fixed in test build. Thanks for the help.

---
And my apologies for taking so long to point out the issue and my weird, unclear descriptions. Maybe the alpha channel would be a more correct term. idk.
User avatar
xnview
Author of XnView
Posts: 48148
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: AVIF leak

Post by xnview »

:bugconfirmed: Thanks to your detailed description I can reproduce the problem.
User avatar
xnview
Author of XnView
Posts: 48148
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: AVIF leak

Post by xnview »

This problem is supposed to be fixed in XnView MP 1.11.4. Please check and confirm the bug fix here.