RFR: 8283225: [AIX] ClassLoader.c produces incorrect OutOfMemory Exception when length is 0 [v3]

Roger Riggs rriggs at openjdk.java.net
Thu Mar 17 14:51:34 UTC 2022


On Thu, 17 Mar 2022 07:44:35 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Tyler Steele has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
>> 
>>   Addresses failure in NullClassTest on AIX.
>>   
>>   - Changes malloc(0) call to malloc(1) on AIX.
>
> src/java.base/share/native/libjava/ClassLoader.c line 102:
> 
>> 100:     }
>> 101: 
>> 102:     // On malloc(0), implementators of malloc(3) have the choice to return either
> 
> It is confusing to mix `malloc(0)`, where you are passing an argument zero to malloc, with `malloc(3)` which actually means the definition of malloc as per the man page in section 3.
> 
> Given this is only an issue on AIX the comment can simply say:
> 
> `// On AIX malloc(0) returns NULL which looks like an out-of-memory condition; so adjust it to malloc(1)`.

I would omit the bug number reference, they get stale and do not age well, cluttering up the source.
Git blame can be used to find the origin of the comment if needed.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7829


More information about the core-libs-dev mailing list