RFR: 8353329: Small memory leak when create GrowableArray with initial size 0 [v2]
Stefan Karlsson
stefank at openjdk.org
Tue Apr 1 15:35:46 UTC 2025
On Tue, 1 Apr 2025 15:19:28 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:
>> Please review this small fix to avoid 1 byte leak when create a GrowableArray with initial size = 0.
>>
>> GrowableArray's c-heap allocator does not check size = 0 and os:malloc(0) will malloc at least 1 byte.
>
> Zhengyu Gu has updated the pull request incrementally with two additional commits since the last revision:
>
> - Copyright year
> - stefank's comment
Changes requested by stefank (Reviewer).
src/hotspot/share/utilities/growableArray.cpp line 48:
> 46: if (max == 0) {
> 47: return nullptr;
> 48: }
I think you missed my request to add blank lines around this block:
Suggestion:
if (max == 0) {
return nullptr;
}
-------------
PR Review: https://git.openjdk.org/jdk/pull/24341#pullrequestreview-2733136744
PR Review Comment: https://git.openjdk.org/jdk/pull/24341#discussion_r2023105688
More information about the hotspot-dev
mailing list