[lworld] RFR: 8368333: [lworld] Add preview mode to ImageReader and JRT file-system [v7]
Roger Riggs
rriggs at openjdk.org
Wed Oct 29 21:15:37 UTC 2025
On Wed, 22 Oct 2025 19:38:45 GMT, David Beaumont <duke at openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/jimage/ImageReader.java line 282:
>>
>>> 280: // preview-only nodes. This is used to add preview-only content to
>>> 281: // directories as they are completed.
>>> 282: private final HashMap<String, Directory> previewDirectoriesToMerge;
>>
>> Can this be cleared or freed after the ImageReader is open. Its no longer needed.
>
> It's used when directories are completed (as stated in the comment):
>
>
> List<Node> previewOnlyNodes = getPreviewNodesToMerge(dir);
> ...
> children.addAll(previewOnlyNodes);
>
>
> This is so that a preview only directory (and all its content) appears correctly in its parent's child list.
So it is no longer needed after that.
Since it is a field of a SharedImageReader that will be kept open for a while, it could be cleared to free the entries and make it clear the map is no longer used.
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1619#discussion_r2471012817
More information about the valhalla-dev
mailing list