RFR: 8340824: C2: Memory for TypeInterfaces not reclaimed by hashcons() [v2]

Roland Westrelin roland at openjdk.org
Tue Oct 1 13:36:23 UTC 2024


On Fri, 27 Sep 2024 18:51:49 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> src/hotspot/share/opto/type.cpp line 3270:
>> 
>>> 3268: }
>>> 3269: 
>>> 3270: const TypeInterfaces* TypeInterfaces::make(const GrowableArray<ciInstanceKlass*>* interfaces) {
>> 
>> I think you can make `_interface` a `ciInstanceKlass**` and do this:
>> 
>>     void* ptr = Type::operator new(sizeof(TypeInterfaces) + sizeof(ciInstanceKlass*) * interfaces->length())
>> 
>> Then `delete ptr` should drop the whole thing.
>
> A `GrowableArrayFromArray` would be mostly compatible with the interface of `GrowableArray`, too.

Ah! nice. I wasn't aware of `GrowableArrayFromArray`. Updated change follows your suggestion.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21163#discussion_r1782833378


More information about the hotspot-compiler-dev mailing list