Hey

Putting this code:

System.out.println("Hello");
BufferedImage bufferedImage = new BufferedImage(620, 420, BufferedImage.TYPE_INT_RGB);
System.out.println("Bye");
		Graphics2D g2d = bufferedImage.createGraphics();
		g2d.setColor(Color.black);
		g2d.fillRect(0, 0, 620,420);  
		g2d.setColor(Color.yellow);

It throws a java.lang.OutOfMemoryError: Java heap space error not displaying the bye. I dont understand as my BufferedImage is nothing at all (simple 620 by 420).

Why is this happening?

reduce the setColor values to (0,0,619,419).

Image may overlapse as the size are identical hence ot of bounds error. try that!

Seems very unlikely that that code fragment, on its own, would run out of heap (unless you're using JavaME?). Maybe it's something in the rest of your code - can you post it all - if it's big a small runnable demo of the part that fails would be even better!

But other code there has nothing to do with this...

Hello is shown on the screen. Bye isnt.

The bufferimage is the problem right?

.....remove the bufferimage refrence to test something and now:

java.net.BindException: Address already in use: JVM_Bind

....what?

OK - run out of memory, then trying to execute a bind that has already been executed.
My best guess is that either you are in a simple infinite loop, or you are making a recursive call without a proper termination condition. I assume that would not be deliberate. Trace the execution with a few well-placed print statements.

OK - run out of memory, then trying to execute a bind that has already been executed.
My best guess is that either you are in a simple infinite loop, or you are making a recursive call without a proper termination condition. I assume that would not be deliberate. Trace the execution with a few well-placed print statements.

Restarted Windows and everything is fixed (" ": New thread coming up....)

This question has already been answered. Start a new discussion instead.