Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid memory leak when PropertyComparator is reused #26869

Closed

Conversation

FlorianKirmaier
Copy link
Contributor

Fixing memoryleak, PropertyComparator was remembering the value it compared in the past.

Fixing memoryleak, PropertyComparator was remembering the value it compared in the past.
@pivotal-issuemaster
Copy link

@FlorianKirmaier Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 27, 2021
@sbrannen sbrannen changed the title Update PropertyComparator.java Avoid memory leak when PropertyComparator is reused Apr 29, 2021
@sbrannen sbrannen self-assigned this Apr 29, 2021
@sbrannen sbrannen added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Apr 29, 2021
@sbrannen sbrannen added this to the 5.3.7 milestone Apr 29, 2021
@sbrannen
Copy link
Member

Thanks for submitting your first PR for the Spring Framework, @FlorianKirmaier!

We would like to merge this into main soon.

Can you please sign the Contributor License Agreement (see #26869 (comment)).

@sbrannen sbrannen added the status: waiting-for-feedback We need additional information before we can continue label Apr 29, 2021
@pivotal-issuemaster
Copy link

@FlorianKirmaier Thank you for signing the Contributor License Agreement!

@FlorianKirmaier
Copy link
Contributor Author

Just signed the CLA.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Apr 30, 2021
@sbrannen sbrannen removed the status: feedback-provided Feedback has been provided label Apr 30, 2021
return this.beanWrapper.getPropertyValue(this.sortDefinition.getProperty());
BeanWrapperImpl beanWrapper = new BeanWrapperImpl(false);
beanWrapper.setWrappedInstance(obj);
return beanWrapper.getPropertyValue(this.sortDefinition.getProperty());
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that the formatting you introduced fails the build with the following.

> Task :spring-beans:checkstyleMain
[ant:checkstyle] [ERROR] /.../spring-beans/src/main/java/org/springframework/beans/support/PropertyComparator.java:116: Line has leading space characters; indentation should be performed with tabs only. [RegexpSinglelineJava]
[ant:checkstyle] [ERROR] /.../spring-beans/src/main/java/org/springframework/beans/support/PropertyComparator.java:117: Line has leading space characters; indentation should be performed with tabs only. [RegexpSinglelineJava]
[ant:checkstyle] [ERROR] /.../spring-beans/src/main/java/org/springframework/beans/support/PropertyComparator.java:118: Line has leading space characters; indentation should be performed with tabs only. [RegexpSinglelineJava]

Please make sure you run ./gradlew check before submitting a PR to catch such errors locally.

I'll fix the formatting before merging, so there's no need to update this PR.

@sbrannen sbrannen closed this in b5d6e53 Apr 30, 2021
@sbrannen
Copy link
Member

This has been merged into main.

Thanks

Zoran0104 pushed a commit to Zoran0104/spring-framework that referenced this pull request Aug 20, 2021
This commit fixes a potential memory leak, since PropertyComparator
previously kept an indirect reference to the value it last compared.

Closes spring-projectsgh-26869
lxbzmy pushed a commit to lxbzmy/spring-framework that referenced this pull request Mar 26, 2022
This commit fixes a potential memory leak, since PropertyComparator
previously kept an indirect reference to the value it last compared.

Closes spring-projectsgh-26869
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants