I have a program that requires textSize to increase over time. When running it gradually, i.e. textSize(4),5,6,7,etc., the number can reach a very high value without anything bad happening. However, if I try to start off with a high value (the same number as gradually approached), it throws an OutOfMemory exception:
java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space at processing.opengl.PSurfaceJOGL$2.run(PSurfaceJOGL.java:484) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.OutOfMemoryError: Java heap space at java.awt.image.DataBufferInt.(DataBufferInt.java:75) at java.awt.image.Raster.createPackedRaster(Raster.java:467) at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1032) at java.awt.image.BufferedImage.(BufferedImage.java:324) at processing.core.PFont.(PFont.java:232) at processing.core.PFont.(PFont.java:337) at processing.core.PGraphics.createFont(PGraphics.java:4078) at processing.core.PApplet.createFont(PApplet.java:6254) at processing.core.PApplet.createDefaultFont(PApplet.java:6188) at processing.core.PGraphics.defaultFontOrDeath(PGraphics.java:8219) at processing.core.PGraphics.textSize(PGraphics.java:4391) at processing.core.PApplet.textSize(PApplet.java:12688) at recaman.draw(recaman.java:150) at processing.core.PApplet.handleDraw(PApplet.java:2418) at processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:907) at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692) at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674) at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:443) at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293) at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147) at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:759) at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81) at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452) at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178) at java.util.TimerThread.mainLoop(Timer.java:555) at java.util.TimerThread.run(Timer.java:505)
Any help would be appreciated.