java - why my exception is not caught? -


i have code generates following exception:

exception in thread "main" java.lang.outofmemoryerror: java heap space     @ edu.createarrays(exhaustivepcfgparser.java:2188)     @ edu.considercreatingarrays(exhaustivepcfgparser.java:2158)     @ edu.exhaustivepcfgparser.parse(exhaustivepcfgparser.java:339)     @ edu.lexicalizedparserquery.parse(lexicalizedparserquery.java:247)     @ edu.lexicalizedparser.apply(lexicalizedparser.java:283)     @ current.gen.textparsen(gen.java:162)     @ current.gen.gen(gen.java:90)     @ current.foo.main(foo.java:120) 

i tried catch following code:

try {     // line cause exception     linkedlist<foo> erg = gen.gen(rev); } catch (exception e) {     system.out.println("exception: out of memory"); }    

but when run code exception not caught. how solve this?

because that's not exception error.

you catch throwable

} catch (throwable e) { 

or error

} catch (error e) { 

but there's not lot can such error, apart trying close application in cleanest way can.

from the javadoc :

an error subclass of throwable indicates serious problems reasonable application should not try catch


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -