This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

idea for StackOverflowException



As I recall, the major impediment to implementing
StackOverflowException is having to call new from within the
stack-overflow signal handler -- at that point, you have no stack
left with which to call StackOverflow's constructor.

How about this: in Thread.start(), scan the stack area by writing to
each location, in progressively increasing until you get a stack
overflow signal (for speed, consider an exponentially increasing
search, followed by a binary search). Then, write-protect the top page
of the stack. When a write to the top page is detected, throw a
StackOverflowException and allow writes to the top page until the
exception is caught.

That way, you never have to attempt to throw an exception or call new
from inside the stack overflow signal handler.

Would this work?

  - a


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]