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]
# 1
Wow! 15 threads!I can say that you should definitely get rid of 13 threads in that one.> To make 1 drawing thread in this program impossible.I seriously doubt that. Give me one reason why you can't do drawing in 1 thread. A good reason.
Kayamana at 2007-7-9 16:32:08 > top of Java-index,Other Topics,Java Game Development...
# 2

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:-)

LAOndaa at 2007-7-9 16:32:08 > top of Java-index,Other Topics,Java Game Development...
# 3
You're using a swing component?Do you realize that it's incredibly slow?How did you even come up with an idea like that?
Kayamana at 2007-7-9 16:32:08 > top of Java-index,Other Topics,Java Game Development...
# 4

Well i need to implement it using other components which are based on swing components. The grafical view is only a small part of an much bigger program. Even tho it isn't only my idea. In the whole program it is the only idea what is possible to make it work. But i am not here to defend my solution. I just wanted to know if there was a possibilitie to use Buffered or Volatile Image with many treads.

LAOndaa at 2007-7-9 16:32:08 > top of Java-index,Other Topics,Java Game Development...
# 5
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.
Kayamana at 2007-7-9 16:32:08 > top of Java-index,Other Topics,Java Game Development...
# 6

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.

ruxpina at 2007-7-9 16:32:08 > top of Java-index,Other Topics,Java Game Development...