Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OutOfMemoryError in java swing application

 
Kuppuraj Govindhasamy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am getting OutOfMemoryError in my java swing application as below.
Exception occurred during event dispatching:
java.lang.OutOfMemoryError
at sun.awt.image.Image.<init>(Compiled Code)
at sun.awt.windows.WImage.<init>(Compiled Code)
at sun.awt.windows.WOffScreenImage.<init>(Compiled Code)
at sun.awt.windows.WComponentPeer.createImage(Compiled Code)
at java.awt.Component.createImage(Compiled Code)
at java.awt.Component.createImage(Compiled Code)
at java.awt.Component.createImage(Compiled Code)
at java.awt.Component.createImage(Compiled Code)
at java.awt.Component.createImage(Compiled Code)
at java.awt.Component.createImage(Compiled Code)
at java.awt.Component.createImage(Compiled Code)
at java.awt.Component.createImage(Compiled Code)
at java.awt.Component.createImage(Compiled Code)
at itm.map.MapView.paint(Compiled Code)
at javax.swing.JComponent.paintChildren(Compiled Code)
at javax.swing.JComponent.paint(Compiled Code)
at javax.swing.JComponent.paintChildren(Compiled Code)
at javax.swing.JSplitPane.paintChildren(Compiled Code)
at javax.swing.JComponent.paint(Compiled Code)
at javax.swing.JComponent.paintChildren(Compiled Code)
at javax.swing.JSplitPane.paintChildren(Compiled Code)
at javax.swing.JComponent.paint(Compiled Code)
at javax.swing.JComponent.paintChildren(Compiled Code)
at javax.swing.JComponent.paint(Compiled Code)
at javax.swing.JComponent.paintChildren(Compiled Code)
at javax.swing.JComponent.paint(Compiled Code)
at javax.swing.JComponent.paintChildren(Compiled Code)
at javax.swing.JComponent.paint(Compiled Code)
at javax.swing.JLayeredPane.paint(Compiled Code)
at javax.swing.JComponent.paintChildren(Compiled Code)
at javax.swing.JComponent.paint(Compiled Code)
at java.awt.Container.paint(Compiled Code)
at itm.map.ItmMap.update(Compiled Code)
at sun.awt.windows.WComponentPeer.handleEvent(Compiled Code)
at java.awt.Component.dispatchEventImpl(Compiled Code)
at java.awt.Container.dispatchEventImpl(Compiled Code)
at java.awt.Window.dispatchEventImpl(Compiled Code)
at java.awt.Component.dispatchEvent(Compiled Code)
at java.awt.EventDispatchThread.run(Compiled Code)

Is it possible to fix this?
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where is the class itm.map.MapView coming from? What is the code supposed to do?

Have you tried reserving more heap space?
 
Kuppuraj Govindhasamy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am starting my application using below command(you the heap size given there).
jre -noclassgc -classpath %CLASSPATH% -mx256m -ms99m -Dnmsfmint.remote=true -Dnmsfmint.fmname=%FMNAME% %D_PARAMS% %nmxclient% itm.map.ItmRun gt=%tracelevel% lang=english log=%logfile% nmHelp=%juidrive%%juiroot%\jnm\itm\help\appl\lang\english xmHelp=%juidrive%%juiroot%\jnm\itm\xm\help\appl\lang\english tr=true tc=%TRUE_COLOR% fm=NONE

MapView class is drawing some icons on the Painting area.
 
Kuppuraj Govindhasamy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry for missing words. you can the see the heap size in the jre command.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is very easy to create memory "leaks" in Swing if you don't properly dispose of listeners. The swing forum is where you will get help on this.

Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic