RFR: 8296270: Memory leak in ClassLoader::setup_bootstrap_search_path_impl
Man Cao
manc at openjdk.org
Fri Nov 4 22:33:30 UTC 2022
On Fri, 4 Nov 2022 01:20:41 GMT, Man Cao <manc at openjdk.org> wrote:
> Hi all,
>
> Could anyone help review this fix for a memory leak? There is a redundant code branch in ClassLoader::setup_bootstrap_search_path_impl() for exploded-image build that is unnecessary and causes a leak.
>
> I'm sponsoring colleague Justin King (jcking at google.com) for this contribution, who remarkably made LeakSanitizer working for HotSpot and found this leak.
>
> @jianglizhou also helped validate this fix. Quoting her comment:
>> For the ClassPathEntry* new_entry = create_class_path_entry(current, path, &st, false, false); else case with an exploded build in jdk head codebase, it does appear to be not needed. It only creates the class path entry for <path>/modules/java.base, which is handled by [ClassLoader::add_to_exploded_build_list](http://google3/third_party/java_src/jdk/head/src/src/hotspot/share/classfile/classLoader.cpp;l=671;rcl=478881875) later again. Just to be sure, I checked in lldb. The <path>/modules/java.base module path entry is created twice.
>
> -Man
Results from `make exploded-test` for tier1 and tier2:
Without any change:
TEST TOTAL PASS FAIL ERROR
>> jtreg:test/hotspot/jtreg:tier1 2201 2146 55 0 <<
>> jtreg:test/jdk:tier1 2205 2178 27 0 <<
>> jtreg:test/langtools:tier1 4351 4346 5 0 <<
jtreg:test/jaxp:tier1 0 0 0 0
jtreg:test/lib-test:tier1 0 0 0 0
>> jtreg:test/hotspot/jtreg:tier2 741 494 247 0 <<
>> jtreg:test/jdk:tier2 3986 3806 178 2 <<
jtreg:test/langtools:tier2 11 11 0 0
>> jtreg:test/jaxp:tier2 470 379 91 0 <<
With this change and JDK-8296347
TEST TOTAL PASS FAIL ERROR
>> jtreg:test/hotspot/jtreg:tier1 2197 2144 53 0 <<
>> jtreg:test/jdk:tier1 2205 2178 27 0 <<
>> jtreg:test/langtools:tier1 4351 4346 5 0 <<
jtreg:test/jaxp:tier1 0 0 0 0
jtreg:test/lib-test:tier1 0 0 0 0
>> jtreg:test/hotspot/jtreg:tier2 742 494 248 0 <<
>> jtreg:test/jdk:tier2 3986 3806 178 2 <<
jtreg:test/langtools:tier2 11 11 0 0
>> jtreg:test/jaxp:tier2 470 379 91 0 <<
Some tests are apparently flaky.
I compared the diff of `summary.txt`, and did not find any new failures.
There seems some problem with counting the total tests. `summary.txt` for hotspot/tier1 shows 2201 lines in both runs, but second run only counts 2197 total tests. Similarly `summary.txt` for hotspot/tier2 shows 742 lines in both runs.
Overall, I think this is good to go. The presubmit test failures also seem unrelated.
-------------
PR: https://git.openjdk.org/jdk/pull/10973
More information about the hotspot-runtime-dev
mailing list