Replies: 3 comments 4 replies
-
Png has to convert your pixel format into a compatible one for encoding. I would suggest using an explicit Other than that, no not really. It's doing more work. There might be optimization opportunities but the code is there for you to improve upon. |
Beta Was this translation helpful? Give feedback.
-
I cannot repro this with the images and code from #2691 (comment), unmanaged memory use peaked around 20MB for me. @IshmaZX82 if the profiler screenshot is from your real app, you may be missing |
Beta Was this translation helpful? Give feedback.
-
Profiler screenshot for SimpleGcMemoryAllocator:
I did some more tests. My problem is reproduced in the simple empty Asp.Net Core application, but not reproduced in the .Net application. In the Asp.Net Core application I made the following trick: I call GC.Collect() after processing every 500 files, and the memory problem also disappeared. |
Beta Was this translation helpful? Give feedback.
-
I have a problem with a large amount of unmanaged memory being used.
The test application processes a large number of images, downloads them one by one and saves them in the selected format.
The test uses 7000 images, the average size is 128*128 pixels.
For most formats, memory consumption is approximately 300-400 megabytes.
But when choosing the Png format, memory consumption increases to 800-900 megabytes.
The profiler shows a large amount of occupied unmanaged memory.
Calling the GC.Collect method immediately after operations does not help, memory begins to be freed only after some time.
Is there any way to reduce unmanaged memory consumption?
My sample code:
Archive with used pictures:
https://www.dropbox.com/scl/fi/wwzd8vsfqmo4f86lubcmq/images.zip?rlkey=s5bqfejidpfxn9464xjwt99fu&dl=0
Profiler screenshot:
Beta Was this translation helpful? Give feedback.
All reactions