This is the mail archive of the java-discuss@sourceware.cygnus.com 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]

RE: NullPointerException / threads


> In order to solve this problem, we could create a new
> NullPointerException in the context of the signal handler, but that
> may crash if the SEGV occurs in the memory allocator itself.  Also,
> fillInStackTrace calls JvNewByteArray to hold the stack trace, and if
> this fails we'll crash anyway, so maybe a SEGV handler shouldn't even
> be calling fillInStackTrace.
> 
> I suppose we could create a NullPointerException and a pre-allocated
> stacktrace for each thread when it starts, but that seems rather
> nasty.

Can you tell at SEGV-time if you're currently in the allocator?  If so,
you could preallocate an 'emergency' exception+array, and use it only
in that case.  The non-allocator case would create a new object normally.

This would fail if multiple threads SEGV in the memory 
allocator, but by that point you may be dead anyway...

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