The reason I think it may be a bug in BlueJ is due to the Internal BlueJ error reference in the error message,
The Terminal window displays "java.lang.OutOfMemoryException"
If imageSize is set to 1887 or lower, no error message is shown.
I have enclosed the java files - could you tell me if this is a BlueJ bug (and how to report it - I looked at BugZilla but I didn't understand it at all) or if this is my own programs bug, can someone tell me what I am doing wrong.
How do I increase the memory available to my program?
It's a runtime parameter to the program. The way to do that is IDE specific so I'll defer to someone who has used this IDE.
Also, why would the program be running out of memory? Are the BufferedImage's I am creating too large? Is there a better way to create a less memory hungry offscreen image buffer?
It looks like you create four copies of this image buffer to read the same image. That would eat up more memory than necessary. You could share references to this buffer (by passing it as a parameter.)
Your code is throwing an OutOfMemory error. You are correct that there is a bug in the IDE. Instead of gracefully telling you that the program is using too much memory, it is throwing an ArrayIndexOutOfBoundsException.
Eric describes the command to increase memory. It's the same command. You just need to figure out how to it for your IDE.
D R Wilkinson
Joined: Oct 29, 2004
Thank you very much for the reply Jeanne :-)
I have worked out how to increase BlueJ's memory allocation - thanks for the pointer.
Re: The 4 BufferedImage's. I intend displaying 4 different hex maps. At the moment the maps are identical but that was just while I worked out how to actually display 4 hex maps - that done, I am working on displaying 4 different hex maps.
Are you saying that I could use one BufferedImage object for displaying all four maps?
I am guessing that this could be possible as the user can only use one map at a time (scrolling, clicking, etc) thus the single BufferedImage object could be used to display each different hex map.
Is this what you mean? If it is then I will start to work out how to use one BufferedImage object to display 4 different maps.