RFR: 8316669: ImmutableOopMapSet destructor not called
Thomas Schatzl
tschatzl at openjdk.org
Thu Sep 21 20:11:13 UTC 2023
On Thu, 21 Sep 2023 19:29:19 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> src/hotspot/share/code/codeBlob.cpp line 179:
>>
>>> 177: if (_oop_maps != nullptr) {
>>> 178: _oop_maps->~ImmutableOopMapSet();
>>> 179: FREE_C_HEAP_ARRAY(unsigned char, _oop_maps);
>>
>> Using FREE_C_HEAP_ARRAY here is concerning (even if it worked for years). CodeBlob should not know what `_oop_maps` is look like inside - he sees its type is `ImmutableOopMapSet*` and not an array.
>>
>> Thank you for adding the destructor. It should free memory used by `_oop_maps`.
>
> If you are not comfortable to do such changes, file separate RFE to fix it later.
> Thank you for adding the destructor. It should free memory used by _oop_maps.
I can do that, but that would mean that the object would free its own memory it is running on which seems unusal.
Maybe it is best to add a static free_oop_map_set or similar method to ImmutableOopMapSet that frees that memory? Then that class would nominally both allocate and deallocate that object's memory.
What do you think?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15862#discussion_r1333551639
More information about the hotspot-compiler-dev
mailing list