RFR: 8252049: Native memory leak in ciMethodData ctor [v4]
Kim Barrett
kbarrett at openjdk.java.net
Tue Dec 8 01:56:13 UTC 2020
On Mon, 7 Dec 2020 15:38:28 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:
>> `ciMethodData` embeds `MethodData` to snapshot a state from the original `MethodData` instance.
>> But `MethodData` embeds a `Mutex` which allocates a platform-specific implementation on C-heap.
>> The `Mutex` is overwritten with `0`s, but the resources aren't deallocated, so the leak occurs.
>>
>> Proposed fix is to run Mutex destructor right away.
>>
>> Initially, I thought about switching to `Mutex*`, but then I found that Coleen already tried that and observed a performance regression [1]. So, for now I chose the conservative approach.
>>
>> In the longer term, I would consider replacing `MethodData::_extra_data_lock` with a lock-free scheme. Having a lock-per-MDO looks kind of excessive.
>>
>> Testing:
>> - [x] verified that no memory leak observed with the reported test
>> - [x] tier1-4
>>
>> [1] https://mail.openjdk.java.net/pipermail/hotspot-dev/2019-October/039783.html
>
> Vladimir Ivanov has updated the pull request incrementally with one additional commit since the last revision:
>
> Cleanups
One lingering question. The name CompilerCounters seems much better, BTW.
src/hotspot/share/oops/methodData.hpp line 1987:
> 1985:
> 1986: public:
> 1987: CompilerCounters() : _nof_decompiles(0), _nof_overflow_recompiles(0), _nof_overflow_traps(0) {
This doesn't initialize _creation_mileage. Is that a bug? Should that be a constructor argument?
-------------
PR: https://git.openjdk.java.net/jdk/pull/1478
More information about the hotspot-compiler-dev
mailing list