RFR (S) round 0 for 8135195 VM Options file should not be limited to 1024 bytes

Gerald Thornbrugh gerald.thornbrugh at oracle.com
Thu Sep 24 15:16:37 UTC 2015


Hi Ron,

I have a small nit, I am not sure about every instance of realloc() but 
the linux version says:

         If realloc() fails the original block is left untouched; it is 
not freed or moved.

It might be better to assign the buffer returned by realloc() to a 
different variable so that you can
free the original buffer on error. Then set "buf" to the value if there 
was not an error.

Something like this:

3546     read_offset = bytes_allocated;  // remember where to read next 
block
3547     // '+ 1' for NULL termination with full buffer.
3548     newbuf = REALLOC_C_HEAP_ARRAY_RETURN_NULL(char, buf,
3549                                            bytes_allocated + 
OPTION_BUFFER_SIZE + 1,
3550                                            mtInternal);
3551     if (newbuf == NULL) {
3552       jio_fprintf(defaultStream::error_stream(),
3553                   "Could not reallocate read buffer for options 
file parse\n");
                FREE_C_HEAP_ARRAY(char, buf);
3554       os::close(fd);
3555       return JNI_ENOMEM;
3556     }
              buf = newbuf;

Since this is option processing and the thread is exiting anyway it is 
probably not a big deal.
You can leave it as is if you wish.

Other than that your fix looks good.

Jerry
> On 9/24/15 8:35 AM, Ron Durbin wrote:
>> Here is the round 0 webrev for 8135195
>>
>> Webrev link:
>> http://cr.openjdk.java.net/~rdurbin/Webrevs/JDK-8135195/OCR0_JDK9/webrev/ 
>>
>
> The above link did not work. I found the webrev here:
>
> http://cr.openjdk.java.net/~rdurbin/8135195_OCR0_JDK9_webrev/
>
> Dan
>
>>
>> RFE request:
>> https://bugs.openjdk.java.net/browse/JDK-8135195
>>
>> This RFE removes the limitation on the size of VM Options files. That 
>> limit is currently 1K bytes.
>> Removing that limit will allow options files to be read with no 
>> practical size limit.
>>
>> This feature has been tested on:
>>      OS:
>>        Solaris, MAC, Windows, Linux
>>      Tests:
>>        Manual unit tests
>>        JPRT with -testset hotspot (including the SQE proposed test 
>> coverage for this feature.)
>



More information about the hotspot-runtime-dev mailing list