Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

How to optimize Image loading?

Avatar of Crazy_Bytes
Crazy_BytesFlag for Germany asked on
Java
13 Comments1 Solution1068 ViewsLast Modified:
Hi everyone,

i wrote an application to create and to manage websites. The app also contains a module to generate and display galeries. I use threads to load each image and join them so that only one image will be loaded at the same time. The images are resized and displayed as thumbnails.

As long as the images are small (about 40 kBytes(.jpg-Format)) with an average size of 640 x 480 pixel with the default memory settings for the JVM,  there are no problems no matter how large a galery is.

But when I use high res images with about 5 MBytes and an average size of 2400 x 1800 pixel or even higher, the load process of the galery crashes after the 10th to 20th picture even when I give the JVM a maximum memory between 512 MBytes and 2048 MBytes.

I create an instance of the image through a buffered image and create a scaled instance into an ImageIcon. After this I dispose the buffered image and set the buffered image to null and manually call the garbage collector afterwards. Due to the gc call the load time increased.

Has anybody a hint how to optimize the load process?

Currently I am not at my developer pc, when i get back to it I will post the loading routine to ease assistance.

Thanks and greetings,
CB

ASKER CERTIFIED SOLUTION
Avatar of CEHJ
Commented:
This problem has been solved!
Unlock 1 Answer and 13 Comments.
See Answers