1 Reply Latest reply on Jun 14, 2013 9:02 AM by user6309181

    OutOfMemoryError in Java ME SDK 3.0 and 3.2 emulator

      Hello together,

      in a little card game I currently develop for the Java ME platform I use SVGImages created at runtime (that is, not loaded from resources as .svg or .xml files) to render the respective cards on ScalableGraphics. One can use the arrow keys or the touch screen to move the focus around the cards on the board, but if this is done an indefinite number of times (usually around five) immediately after starting, the emulator runs into the following problem (making the cards disappear from screen and any further drawing impossible):

      TRACE: <at java.lang.OutOfMemoryError>, Exception caught in Display class
      (stack trace incomplete)

      TRACE: <at java.lang.IllegalStateException: bindTarget(javax.microedition.lcdui.Graphics@e5125d64) with g : javax.microedition.lcdui.Graphics@e5125d64>, Exception caught in Display class
      java.lang.IllegalStateException: bindTarget(javax.microedition.lcdui.Graphics@e5125d64) with g : javax.microedition.lcdui.Graphics@e5125d64
      - javax.microedition.m2g.ScalableGraphics.bindTarget(), bci=71
      - SVGCanvas.paint(), bci=25
      - javax.microedition.lcdui.CanvasLFImpl.uCallPaint(), bci=202
      - javax.microedition.lcdui.Display.callPaint(), bci=149
      - javax.microedition.lcdui.Display$DisplayEventConsumerImpl.handleRepaintEvent(), bci=11
      - com.sun.midp.lcdui.RepaintEventProducer.process(), bci=55
      - com.sun.midp.events.EventQueue.run(), bci=179
      - java.lang.Thread.run(), bci=11

      I am quite helpless with both diagnosing and resolving this issue because I cannot judge if I am doing something completely insane in my source or I have really found some quirks in the emulator. I correctly bindTarget() / releaseTarget() the Graphics object to ScalableGraphics, however, I do this every time a card has to be repainted, perhaps this is too much? I want to stress that this does only occur in the emulator shipped with the Java ME Platform SDK 3.0 and 3.2, but it does not in 3.0.5 or any other emulator I could get hold of.

      I have stripped down my more complex source to the following sample application "SVGMidlet", which exactly reproduces the error and can be obtained via


      Best regards, Oliver Pfeiffer