final BufferedImage img = new BufferedImage(3500, 2480, BufferedImage.TYPE_BYTE_INDEXED);
final Graphics2D g2D = img.createGraphics();
g2D.setBackground(Color.white);
g2D.clearRect(0, 0, width, height);
(full code in this question).
This code results in a Java Heap Space exception although I've set the jvm attribute to 3GB. Could that be the problem?
Anyway isn't it possible to draw the image with less memory? I'm after an A4-size BMP for printing, only with text. Most of the time it's black-and-white only, while at some times I'll need to use blue, pink, and gray too.