|
From: Garcia, M. <mg...@Bu...> - 2001-03-15 20:47:35
|
Hi Ype,
I don't believe you can catch an OutOfMemoryError. It does not inherit from
java.lang.Exception but is a VirtualMachineError and signals that the
garbage collector is unable to free any memory.
If you are getting this error you should check your code because something
serious is happening that should not be. Sounds like you have a memory leak
somewhere, which yes, can happen in Java.
regards,
Mick
-----Original Message-----
From: Ype Kingma
To: jyt...@li...
Sent: 3/15/01 2:53 PM
Subject: [Jython-dev] Catching java.lang.OutOfMemoryError
Dear jtyhon developers,
I had google look for some earlier discussion on this subject
as I vaguely recall java and jython exceptions being discussed
not too long ago. However I could not find anything specific
on my problem.
I have roughly the following situation:
import java
somejythonfile = ....
try:
execfile(somejythonfile)
except SomePythonDeclaredException, ke:
nicelyCaught = ke
except java.lang.OutOfMemoryError, oome:
neverCaught = oome
except Exception, e:
someTimesCaught = e
except:
# some releases ago, I tried this to catch an occasional
# internal compiler error, and then it never occurred again...
ei = sys.exc_info
...
My problem is that java.lang.OutOfMemoryError is never caught,
even when 'somejythonfile' causes it.
I also tried to catch java.lang.Throwable, but it flew along as well.
Do I have to go through some java code:
try {
org.python.core.__builtin__.execfile(somejythonfile);
// or whatever it is called in java
} catch (java.lang.OutOfMemoryException oome) {
throw org.python.core.PyException(oome.toString());
}
or can it be done directly in jython?
I realize that running out of memory is tricky business, but
it would be nice if catching this exception would be possible...
Thanks in advance,
Ype
_______________________________________________
Jython-dev mailing list
Jyt...@li...
http://lists.sourceforge.net/lists/listinfo/jython-dev
|