You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Tamás Cservenák (Jira)" <ji...@apache.org> on 2022/04/13 10:48:00 UTC

[jira] [Assigned] (MRESOLVER-250) Usage of descriptors map in DataPool prevents gargabe collection

     [ https://issues.apache.org/jira/browse/MRESOLVER-250?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tamás Cservenák reassigned MRESOLVER-250:
-----------------------------------------

    Assignee: Tamás Cservenák

> Usage of descriptors map in DataPool prevents gargabe collection
> ----------------------------------------------------------------
>
>                 Key: MRESOLVER-250
>                 URL: https://issues.apache.org/jira/browse/MRESOLVER-250
>             Project: Maven Resolver
>          Issue Type: Bug
>          Components: Resolver
>    Affects Versions: 1.6.3
>         Environment: Linux, Java 11
>            Reporter: Frank Upgang
>            Assignee: Tamás Cservenák
>            Priority: Major
>             Fix For: 1.8.0
>
>         Attachments: image-2022-04-12-16-36-19-783.png, image-2022-04-12-16-36-49-903.png, image-2022-04-13-12-35-15-582.png
>
>
> While resolving a lot of rather huge dependency trees in my application I observed a high heap consumption by {_}org.eclipse.aether.internal.impl.collect.DataPool{_}.
> The _DataPool_ holds _Descriptor_ references in a {_}WeakHashMap{_}.
> Unfortunately, the key is indirectly referenced by the value - thus is is never eligible for garbage collection.
> The key is _an Artifact_ taken from the {_}ArtifactDescriptorRequest{_}.
> The value is an _ArtifactDescriptorResult_ which references the _Artifact_ (key) and the {_}ArtifactDescriptorRequest{_}.
> To fix this the value should be wrapped in a _WeakReference_ or {_}SoftReference{_}.
> This is what the _ObjectPools_ does which is used by the _DataPool_ for _Artifacts_ and {_}Dependencies{_}.
>  
> My use case is an application that indexes the dependency trees of all our services. Therefore there is a lot of dependency resolution when building the index.
> I implemented a workaround by wrapping the value in a WeakReference. The memory consumption is significantly lower afterwards as shown by the attached screenshots.
>  
> If desired, I would create a pull request, but I haven't set up a maven workspace yet.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)