Buffered or Volatile Image out of memory
Hi all, :-)
I have the following problem. I have a program who uses 15 threads. Every single thread must draw about 100 objects. I have tried to use buffered or volatile images for every single tread. But by the fourth thread it shows out of memory. Is there a solution for this problem to speed up the performance and to get rid of "out of memory"? To make 1 drawing thread in this program impossible. The objects who needs to be drawn exists of 1 icon and some lines.
[483 byte] By [
LAOndaa] at [2007-9-28 5:21:14]

I use a JLayeredpane who holds 15 layers. Every layer must/can hold a different update rate. (0.5 second or above) So one layer can hold an update rate of 1 second and another layer has an update rate of 3 seconds. All these layers got different information which can be obtaint from different servers. Also the objects that must be drawn on 1 layer must be selectable and drag- an dropable. Also every layer must have the possibilitie to be drawn above/under another layer. The layers must be switchable.
Is this a good reason? Another solution for this problem is also welcom:-)
I don't imagine that images would have any problems with threads, but having 15 threads is costly. You can always increase the heap size for the JVM, but still I believe there's a better way to do what you're trying to do.
Rather then using 15 threads, keep track of time in some common variable, and just have the drawing thread update whichever layer needs to be updated.
This would be better for many reasons, one being that there are fewer context switches taking place, and the drawing should be faster, and less memory used.