RFR: 8355013: GrowableArray default constructor should not allocate [v2]

Quan Anh Mai qamai at openjdk.org
Fri Apr 18 08:24:55 UTC 2025


> Hi,
> 
> This patch changes the default constructors of `GrowableArray` so that it does not allocate. This is helpful because sometimes we create a `GrowableArray` and append another into it immediately, or create a `GrowableArray` to merge the value from several branches. In these cases, the default allocation is not needed. This also aligns the behaviour with that of `std::vector`, which does not allocate for default construction.
> 
> Please take a look and leave your reviews, thanks a lot.

Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:

  refine tests

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/24748/files
  - new: https://git.openjdk.org/jdk/pull/24748/files/af6f6405..118ab35b

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=24748&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=24748&range=00-01

  Stats: 15 lines in 1 file changed: 15 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/24748.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24748/head:pull/24748

PR: https://git.openjdk.org/jdk/pull/24748


More information about the hotspot-dev mailing list