RFR: 8268078: ClassListParser::_interfaces should be freed [v2]
Yumin Qi
minqi at openjdk.java.net
Tue Jun 15 23:39:30 UTC 2021
On Tue, 15 Jun 2021 22:47:54 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:
>> This patch frees the `_interfaces`, `_indy_items`, and `_id2klass_table` of `ClassListParser` in its destructor.
>> It also fixes the non-NULL check at line 88.
>>
>> - [x] mach5 tiers 1, 2 tests
>
> Calvin Cheung has updated the pull request incrementally with one additional commit since the last revision:
>
> revert the changes for freeing the _id2klass_table
src/hotspot/share/cds/classListParser.cpp line 93:
> 91: Atomic::store(&_parsing_thread, (Thread*)NULL);
> 92: delete _indy_items;
> 93: delete _interfaces;
In fact below _instance = NULL is not necessary. ClassListParser is a stack object and in ctor, it sets
_instance = this;
So after ClassListParser deallocated from stack, setting it to NULL makes no sense.
If it is heap object, setting it to NULL could not prevent memory leak.
Should we remove it?
-------------
PR: https://git.openjdk.java.net/jdk/pull/4498
More information about the hotspot-runtime-dev
mailing list