On Sat, 22 Oct 2022 01:38:44 GMT, Kim Barrett <kbarr...@openjdk.org> wrote:
> Please review this change to GrowableArray to support capacity management. > Two functions are added to GrowableArray, reserve and shrink_to_fit. Also > renamed the max_length function to capacity. > > Used these new functions in StringDedupTable. > > Testing: mach5 tier1-3 src/hotspot/share/utilities/growableArray.hpp line 544: > 542: if (len > 0) { > 543: new_data = static_cast<Derived*>(this)->allocate(); > 544: for (int i = 0; i < len; ++i) ::new (&new_data[i]) E(old_data[i]); This can be a stupid question as I'm confused a little bit. Why do we reallocate memory for data elements? Could we just move the element pointers from the `old_data`? Then, of course, there would be no need to deallocate the moved data elements. ------------- PR: https://git.openjdk.org/jdk/pull/10827