Description
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.
Attachments
Attachments
Issue Links
- is related to
-
MNG-7677 Maven 3.9.0 is ~10% slower than 3.8.7 in large multi-module builds
- Closed
- relates to
-
MRESOLVER-320 Investigate slower resolving speeds as reported by users
- Closed
- links to