Answer the question
In order to leave comments, you need to log in
Java memory optimization for image manipulation?
I have a program that loads 500 pictures into java and displays them. All this weighs 1500 MB in memory. I made it so that not the full image is loaded, but with 190x80 image resolution. Weight dropped to 800 mb. The garbage collector calls System.gc() every second. Question: Is there anything more that can be done?
Answer the question
In order to leave comments, you need to log in
Are you sure that you need 500 pictures at once?
What screen will this fit on?
Pull up only those pictures that you need right now.
if you don’t need to show them, but just process it somehow, process it in turn, don’t keep everything in memory anyway.
Lazy loading will solve your problems. 500 pictures to twist in memory is bad manners, something is wrong with the design of your program. If we are talking about display, then at least I would make pagination, or lazy loading (and unloading) when scrolling.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question