gback at cs.utah.edu
Tue Jul 28 11:20:44 PDT 1998
> Hmm.. it would be nice if an infinite loop was caught with an out
> of memory exception, instead of a core dump.
Actually, it's supposed to throw a StackOverflowException.
> How hard would this be to fix?
> Possible solutions:
> - Compile in code at the beginning of each method to check the
> stack pointer (this could be done optionally, controlled by
> a command line argument). It should have a negligible effect
> on speed.
This is what Dan Lambright did at the OpenGroup, although they used it
for other reasons. (His mail is in the archives.)
> - Put each thread stack in its own memory mapped region with
> unmapped pages on either side
The problem with that is that you must be able to recover from the
trap you take once you overflow. This is somewhat tricky, as you
obviously cannot handle the trap on the stack you've just overflowed.
A possible solution is to use alternate signal stacks and have the OS
switch stacks for you. If I should have the time, I might look into
how that could be done best in a portable manner.
I should also point out that at this point Kaffe doesn't even throw
OutOfMemoryExceptions properly, which is a related issue.
More information about the kaffe