g**********y 发帖数: 14569 | 1 Thanks all your guys' help!
Finally I dig it out: in MediaTracker.addImage(Image, int), I add a constant 0
as image ID, and waitForID(0) every time.
Somehow, JVM messed up there and can't release the resources even I request
Image.flush().
Now I change it to addImage(image, m_counter), and waitForID(m_counter), plus
that Image.flush(). JVM release graphics resources now. | KG 发帖数: 515 | 2 If u use ImageIcon, u don't have to bother MediaTracker.
【在 g**********y 的大作中提到】 : Thanks all your guys' help! : Finally I dig it out: in MediaTracker.addImage(Image, int), I add a constant 0 : as image ID, and waitForID(0) every time. : Somehow, JVM messed up there and can't release the resources even I request : Image.flush(). : Now I change it to addImage(image, m_counter), and waitForID(m_counter), plus : that Image.flush(). JVM release graphics resources now.
| xt 发帖数: 17532 | 3
It is not surprising that after you call addImage() it will add
that image onto the component without removing others. To my
understanding addImage means you add the image to a list of
the images the compnent holds. Therefore the component still keeps
the references to other images you no longer need after you add a
new image into it. You need to remove the images from that list
to save memory.
As for me, I would use a single Image object and dynamically change the
Graphics object associated wi
【在 g**********y 的大作中提到】 : Thanks all your guys' help! : Finally I dig it out: in MediaTracker.addImage(Image, int), I add a constant 0 : as image ID, and waitForID(0) every time. : Somehow, JVM messed up there and can't release the resources even I request : Image.flush(). : Now I change it to addImage(image, m_counter), and waitForID(m_counter), plus : that Image.flush(). JVM release graphics resources now.
|
|