RFR: 8308116: jdk.test.lib.compiler.InMemoryJavaCompiler.compile does not close files [v3]
Axel Boldt-Christmas
aboldtch at openjdk.org
Mon May 22 16:09:51 UTC 2023
On Fri, 19 May 2023 11:36:57 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.
>
> Axel Boldt-Christmas has updated the pull request incrementally with one additional commit since the last revision:
>
> Apply suggestions from code review
>
> Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>
Got the suggestion to close the fileManager directly. It require some extra refactoring. But does not change the class hierarchy so no test need to be changed. Creating a cleaner patch.
There are some parts that could be extracted into helper methods, but the compile method seems small enough to not require this. And it is harder to keep such a refactoring clean without introducing changes to the class hierarchy.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14001#issuecomment-1557493364
More information about the hotspot-runtime-dev
mailing list