outOfMemory Exception

I am getting runtime error outOfMemory Exception. I tried -mx64m but it didn't work.any suggestions?thanks
[135 byte] By [karine3] at [2007-9-26 4:54:29]
# 1
Did you try something larger (-Xmx128m)? Is it possible that you have many, many classes or other objects that will be allocated to the permanent heap space.Chuck
cmccorvey at 2007-6-29 18:47:46 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2
I read somewhere (can't remember where) that with 1.4 one could 'catch' and OutOfMemoryError. I can't find any way to do this. Does anyone know about this?m
wywiwyg at 2007-6-29 18:47:46 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3

Hi,

you can try to catch Trowable instead of catching Exception (OutOfMemoryError is an error, not an exception).

You have to be cautious if you are using Swing or any other multi-threaded application - I was once trying to catch OutOfMemoryError within the static main() method, but the OutOfMemoryError was created on the Swing thread.

If using Swing you might consider to use catch(Throwable) in each actionPerformed method as a last resort, e.g.

public final void actionPerformed(ActionEvent e) {

try {

doSomething();

} catch(SQLException ex) {

displaySQLERror(ex);

} catch(Throwable ex) {

displayUnknownError(ex);

}

}

hhaag@travel.de at 2007-6-29 18:47:46 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 4
>I tried -mx64m but it didn't work.Didn't work how? It still give an out of memory error or it didn't run at all.The default heap size with 1.3 and maybe 1.2 is 64 meg, so that parameter wouldn't change anything.
jschell at 2007-6-29 18:47:46 > top of Java-index,Java HotSpot Virtual Machine,Specifications...