You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Hervé Boutemy (JIRA)" <ji...@apache.org> on 2019/01/24 16:04:00 UTC

[jira] [Comment Edited] (MNG-6575) make Dependency immutable

    [ https://issues.apache.org/jira/browse/MNG-6575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16751267#comment-16751267 ] 

Hervé Boutemy edited comment on MNG-6575 at 1/24/19 4:03 PM:
-------------------------------------------------------------

when you have many many poms with dependencyManagement inherited, either immutability permits to share the objects instance, either you have many clones...

look at MNG-6571 memory dumps and you'll see the difference: VersionRanges are very much inherited. Before the code change, they were cloned (as much as the number of modules, then 4000 here), while after the cache (allowed because instances are immutable), they where a few shared instances

Dependencies are the same story: inherited in general without update, then instance could be shared. And in the memody dump, you see 4 millions instances, where it could probably be dropped to 1600


was (Author: hboutemy):
when you have many many poms with dependencyManagement inherited, either immutability permits to share the objects instance, either you have many clones...

look at MNG-6571 memory dumps and you'll see the difference: VersionRanges are very much inherited. Before the code change, they were cloned (as much as the number of modules, then 4000 here), while after the cache (allowed because instances are immutable), they where a few shared instances

> make Dependency immutable
> -------------------------
>
>                 Key: MNG-6575
>                 URL: https://issues.apache.org/jira/browse/MNG-6575
>             Project: Maven
>          Issue Type: Improvement
>          Components: Dependencies, Inheritance and Interpolation
>    Affects Versions: 3.6.0
>            Reporter: Hervé Boutemy
>            Priority: Major
>
> while working on Maven memory consumption issue MNG-6571, once VersionRange is made immutable, memory used was divided by 2: the next big expected win is to make Dependency immutable, which would probably once again divide memory by 2 because the vast majority of time, dependencies (be it in dependencyManagement or base dependencies) are inherited without any modification
> this will require to change [ModelMerger|https://maven.apache.org/ref/3.6.0/maven-model/apidocs/org/apache/maven/model/merge/ModelMerger.html] 's {{mergeDependency(Dependency target, Dependency source, boolean sourceDominant, Map<Object,Object> context)}} signature, since is not really an immutable friendly signature
> and also make [Dependency code|https://maven.apache.org/ref/3.6.0/maven-model/apidocs/org/apache/maven/model/Dependency.html] immutable (generated by Modello)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)