Application runs out of memory after compressing many images
Im working on a side project to create a archive and im stumped at this one problem, i didnt encounter this problem before and i need to ask it here, the main issue is in ImageGrabber but i would appreciate if you would spot other bugs
https://github.com/wick3nd/SEP-packager/blob/main/src/SEP%20packager/ImageGrabber.cs
GitHub
SEP-packager/src/SEP packager/ImageGrabber.cs at main · wick3nd/SE...
SteelEngine Package packager is a file compressing program for a in progress game engine - wick3nd/SEP-packager
11 Replies
it happens when i try to compress 3k images stolen from a game but it stops after 1.7-2k images compressed
zero clue if its the cause of your problem, but that
ImageGrabber
should probably either have all non-static fields, or should pass those values as parameters to ImageHeader
/ImageDataStream
, instead of using fields (if you want everything to be static) -- that way it's fully impossible for simultaneous invocations to affect one antothermaking the whole class non static doesnt fix the problem, either does lowering the zstd compression level
even if i close every single program the issue doesnt stop
I'm fairly confident I've solved nothing, but Here's the little bit I rearranged as I was walking through. can PR if you want (or feel free to just take/leave stuff on your own):
https://github.com/wick3nd/SEP-packager/compare/main...John-Paul-R:SEP-packager:jp-thoughts?expand=1
you might get use out of some sort of memory snapshotting/profiling to see what exactly is leaking memory (or at least what types of objects):
https://www.jetbrains.com/help/rider/Attach_to_and_profile_.NET_processes_memory.html#dm-run-a-profiling-session
JetBrains Rider Help
Attach to and profile .NET processes | JetBrains Rider
(there are other tools as well, naturally)
c# memory snapshot
c# memory snapshot at DuckDuckGo
DuckDuckGo. Privacy, Simplified.
i tested it and i need to tell you that it didnt solve anything unfortunately
but its surely cleaner in some places
oh, and thanks for responding to my comments in the follow up commit, I see what you were going for. Of course, feel free to remove mine if they're now irrelevant.
i have changed a few files and made some things use spans but it didnt do anything
i hate this thing, god damn:catfine:
Do you have a place I can get the files to use as input? Happy to give the thing a whirl locally
you could put some random images to it and maybe it would produce same results
just make an image and copy paste it a few thousand times