Martin,

I take your point about the other allocations, but as you say OOM is better 
than SEGV. So possibly good enough?

If NEW returns NULL, then there will be a pending OOM on the stack.

-Chris

On 20 Mar 2013, at 23:12, Martin Buchholz <marti...@google.com> wrote:

> Hi John,
> 
> 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.
> 
> Martin
> 
> 
> On Wed, Mar 20, 2013 at 8:22 AM, John Zavgren <john.zavg...@oracle.com>wrote:
> 
>> Greetings:
>> 
>> Please consider the following fix for a minor memory issue that I found in
>> the file: src/solaris/native/java/lang/UNIXProcess_md.c.
>> 
>> http://cr.openjdk.java.net/~jzavgren/8008118/webrev.01/
>> 
>> Thanks!
>> John Zavgren
>> 

Reply via email to