OutOfMemoryError

Hi,

I'm reading the integer data that is present in a .txt file and upon reading it I'm doing some compution. My program is working well and gud for small amount of data in the file, but when i'm trying to read large of amount of data that is present in the file I'm getting the below mentioned error.

Exception in thread"AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap spa

ce

at DataAnalysis.kohonen(DataAnalysis.java:472)

at DataAnalysis.readfile(DataAnalysis.java:376)

at DataAnalysis$submit.actionPerformed(DataAnalysis.java:215)

at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour

ce)

at java.awt.Component.processMouseEvent(Unknown Source)

at javax.swing.JComponent.processMouseEvent(Unknown Source)

at java.awt.Component.processEvent(Unknown Source)

at java.awt.Container.processEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

The thing that I couldn't able to get is when I'm checking at the lines 472; 376; 215 in my code, those lines are blank lines which dont have any code. I couldn't able to know like what went wrong and where i went wrong.

[2521 byte] By [sarath44a] at [2007-11-27 11:16:23]
# 1

Your best bet to getting useful help in this would be to post a Short, Self Contained, Compilable and Executable, Example Program (SSCCE) that demonstrates the incorrect behaviour. You can find out more about this construct here:

url http://homepage1.nifty.com/algafield/sscce.html

In your case, you would also need the text file or some way for us to generate an equivalent textfile.

Good luck

/Pete

Addendum: Another suggestion: I can see from your error message that you are running your program with a Swing interface. Until you have the logic portion of the program working perfectly, I'd take it out of Swing and make a simple console interface. Again, good luck.

Message was edited by:

petes1234

petes1234a at 2007-7-29 14:18:50 > top of Java-index,Java Essentials,Java Programming...
# 2

Out of memory means what it says - you are storing more data than you've allowed room for. Probabably you are retaining access to data you no longer need - try to process data from a file as it comes in, rather than swallow the whole file at a gulp and then process it.

If you really need large amounts of data in memory then increase the heap size limit by putting a command-line switch like -Xmx256m on the java command.

malcolmmca at 2007-7-29 14:18:50 > top of Java-index,Java Essentials,Java Programming...