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

XmlInputFactory: manually clear the inputstream to allow gc #2128

Merged
merged 3 commits into from
May 30, 2022

Conversation

jonenst
Copy link
Contributor

@jonenst jonenst commented May 19, 2022

Signed-off-by: HARPER Jon jon.harper87@gmail.com

Please check if the PR fulfills these requirements (please use '[x]' to check the checkboxes, or submit the PR and then click the checkboxes)

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Does this PR already have an issue describing the problem ? If so, link to this issue using '#XXX' and skip the rest
NO

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Bug fix

What is the current behavior? (You can also link to an open issue here)
When using a unoptimzed datasource that uses byteArrayInputStreams with the whole xml string in memory, the whole string is kept in memory twice: once for the exists method (the one that is only checking if the xml has a xiidm:network), and one for the import.

What is the new behavior (if this is a feature change)?
whole string Only kept once

Does this PR introduce a breaking change or deprecate an API? If yes, check the following:
NO

@jonenst jonenst changed the title XmlImporter exists: manually clear the inputstream to allow earlier gc XmlImporter exists: manually clear the inputstream to allow earlier gc [WIP] May 19, 2022
@jonenst jonenst force-pushed the fixgcxmlimporter branch 2 times, most recently from d71660a to 2c8ee24 Compare May 19, 2022 10:02
@jonenst jonenst changed the title XmlImporter exists: manually clear the inputstream to allow earlier gc [WIP] manually clear the inputstream to allow gc May 19, 2022
@jonenst jonenst changed the title manually clear the inputstream to allow gc XmlInputFactory: manually clear the inputstream to allow gc May 19, 2022
…allow gc. Make the code more uniform.

A reference to the last inputstream is kept by the factory, and we keep the factory
in a static reference.

Signed-off-by: HARPER Jon <jon.harper87@gmail.com>
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

89.5% 89.5% Coverage
0.0% 0.0% Duplication

@miovd miovd merged commit 21ddbd2 into main May 30, 2022
@miovd miovd deleted the fixgcxmlimporter branch May 30, 2022 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants