RFR: 8308116: jdk.test.lib.compiler.InMemoryJavaCompiler.compile does not close files
Leonid Mesnik
lmesnik at openjdk.org
Tue May 16 20:05:46 UTC 2023
On Tue, 16 May 2023 08:06:15 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
> jdk.test.lib.compiler.InMemoryJavaCompiler.compile(String className, CharSequence sourceCode, String... options) creates a JavaFileManager but fails to close it after the CompilationTask is completed, leaving the file descriptors open until reference processing kicks in.
>
> Graph below shows number of open file descriptors before and after this patch for a program which compiles dummy classes in a loop.
> <img width="1116" alt="Before and after" src="https://github.com/openjdk/jdk/assets/1139284/1ecfb32a-735b-4765-bcca-81f67a4c9816">
>
> Testing: GHA and Oracle CI tier1-3. Tests using jdk.test.lib.compiler.InMemoryJavaCompiler also tested locally.
There are few nits inline.
Also, please update copyright years.
test/lib/jdk/test/lib/compiler/InMemoryJavaCompiler.java line 208:
> 206: }
> 207:
> 208: private static class CloseableCompilationTask implements Closeable {
Does it make a sense to implement Callable<Boolean> as well? Just to make semantic clearer. (It is just suggestion.)
test/lib/jdk/test/lib/compiler/InMemoryJavaCompiler.java line 231:
> 229: }
> 230:
> 231: public void close() throws IOException {
Please add tag Override.
-------------
Marked as reviewed by lmesnik (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/14001#pullrequestreview-1429305499
PR Review Comment: https://git.openjdk.org/jdk/pull/14001#discussion_r1195630422
PR Review Comment: https://git.openjdk.org/jdk/pull/14001#discussion_r1195633033
More information about the hotspot-runtime-dev
mailing list