martinrb at google.com
Wed Mar 20 23:12:31 UTC 2013
I wrote this code originally IIRC. You are correct that the existing code
does not check these allocations for failure. In practice, it will be very
rare for the failure to be seen, since the allocations are likely to be
small and only occur during program startup.
I commend you for trying to get this right, but if you want to get there, I
think you need to throw OOME and undo all of the existing allocations. You
can do that by keeping track of how many elements you already allocated,
freeing them, and throwing OOME. As Alan points out, the exception in the
static initializer shows that recovery is even more problematic than with a
regular OOME. Nevertheless, throwing OOME is going to be a better result
for the user than uninformative SEGV.
On Wed, Mar 20, 2013 at 8:22 AM, John Zavgren <john.zavgren at oracle.com>wrote:
> Please consider the following fix for a minor memory issue that I found in
> the file: src/solaris/native/java/lang/UNIXProcess_md.c.
> John Zavgren
More information about the core-libs-dev