File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes still memory problem with image loading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "still memory problem with image loading" Watch "still memory problem with image loading" New topic
Author

still memory problem with image loading

Kay Tracid
Ranch Hand

Joined: Mar 06, 2002
Posts: 148
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

Joined: Oct 18, 2000
Posts: 4121

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...


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Kay Tracid
Ranch Hand

Joined: Mar 06, 2002
Posts: 148
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...
 
 
subject: still memory problem with image loading