R
R
Rienopely2015-10-21 23:53:47
Java
Rienopely, 2015-10-21 23:53:47

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

2 answer(s)
O
Oleg Gamega, 2015-10-22
@gadfi

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.

V
Viktor Maksimov, 2015-10-22
@ValorVl

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 question

Ask a Question

731 491 924 answers to any question