RFR: 8316669: ImmutableOopMapSet destructor not called

Vladimir Kozlov kvn at openjdk.org
Thu Sep 21 19:31:59 UTC 2023


On Thu, 21 Sep 2023 19:27:30 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> Hi all,
>> 
>>   please review this addition to call the destructor of `ImmutableOopMapSet` before its memory is deleted. There is no functional problem as the destructor is empty, but it is surprising to free new'ed objects without calling its destructor.
>> 
>> Testing: gha
>> 
>> Thanks,
>>   Thomas
>
> 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.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15862#discussion_r1333513948


More information about the hotspot-compiler-dev mailing list