Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

still memory problem with image loading

 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I already posted my problem here. I changed my source code, but I had still an increasing use of memory. Maybe you can help me, i dont know any other solution.
I have 2 JPanels, the first with a button to choose the next pictures. There I load my pictures.
These are shown in the second panel (named picPanel) as an ImageIcon in a label.
The images have different sizes, somtimes 1200 x 1000 and I cant load them in the second Panel, because of the program structure.
I tried a lot and I think the problem is loading the images. I use the MediaTracker.
Please help...
Thanks a lot!
my first panel functions:

second panel


Regards Kay
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How many images are you loading at one time?

And how large are all the images? You mention that some are as large as 1200x1000, I assume that is the "original" size image... but how large are "medium" and "small" images? I think that your problem is that you are loading all these images into memory at once... the thing to do would be to load only small images unless the user explicitly chooses to show larger images...
 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
To load the images when they were shown is a good idea, i will implement it. it will be difficult to change my program structure.
But i think it will not solve my memory problem. The images(a part of them) are still in memory.
I have 3 images,
one is usually between 1200x1000 and 600 x 600, the second is 400 x 400,
the third 100 x 70.
How much pictures i load depense on the results found in database and on the user who "scrolls" between them.
Maybe you known some source examples for my problem? That would be great...
Thanks a lot!
P.S. Sorry, because of my bad language...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic