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

Tyler Steele duke at openjdk.java.net
Thu Mar 17 16:53:39 UTC 2022


On Thu, 17 Mar 2022 14:48:09 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> 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.

I changed to the streamlined comment and removed the bug id. Thanks for your suggestions.

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

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


More information about the core-libs-dev mailing list