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

fixes memory-leak: WeakHashMap -> SoftHashMap<…TickMark> - based cache #291

Merged
merged 1 commit into from
Oct 30, 2020

Conversation

RalphSteinhagen
Copy link
Member

fixed slow memory-leak by replacing WeakHashMap with SoftHashMap<…TickMark> - based cache implementation

See the following references for details:
https://ewirch.github.io/2013/12/weakhashmap-memory-leaks.html
https://franke.ms/memoryleak1.wiki

N.B. latter author filed this as a bug at http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7145759 which was apparently dropped by Oracle devs as supposedly the intended behaviour for a WeakHashMap-based cache.

…TickMark> - based cache implementation

See following references for details:
https://ewirch.github.io/2013/12/weakhashmap-memory-leaks.html
https://franke.ms/memoryleak1.wiki
N.B. latter author filed this as a bug at http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7145759 which was apparently dropped by Oracle devs as supposedly the intended behaviour for a WeakHashMap-based cache.
@codecov
Copy link

codecov bot commented Oct 30, 2020

Codecov Report

Merging #291 into master will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #291      +/-   ##
============================================
+ Coverage     49.78%   49.80%   +0.02%     
- Complexity     6859     6864       +5     
============================================
  Files           380      380              
  Lines         40065    40065              
  Branches       6420     6420              
============================================
+ Hits          19945    19955      +10     
+ Misses        18709    18706       -3     
+ Partials       1411     1404       -7     
Impacted Files Coverage Δ Complexity Δ
...a/de/gsi/chart/axes/spi/AbstractAxisParameter.java 97.64% <ø> (ø) 199.00 <0.00> (ø)
.../main/java/de/gsi/chart/axes/spi/AbstractAxis.java 75.52% <100.00%> (ø) 176.00 <0.00> (ø)
...hart/plugins/measurements/DataSetMeasurements.java 75.77% <0.00%> (+0.34%) 153.00% <0.00%> (+2.00%)
...main/java/de/gsi/chart/ui/HiddenSidesPaneSkin.java 44.97% <0.00%> (+0.47%) 35.00% <0.00%> (+1.00%)
...ava/de/gsi/chart/utils/SimplePerformanceMeter.java 88.70% <0.00%> (+1.61%) 31.00% <0.00%> (ø%)
...ain/java/de/gsi/dataset/utils/CacheCollection.java 91.30% <0.00%> (+4.34%) 19.00% <0.00%> (+1.00%)
...in/java/de/gsi/dataset/utils/DoubleArrayCache.java 100.00% <0.00%> (+8.00%) 13.00% <0.00%> (+1.00%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eb7a286...ba7f2ac. Read the comment docs.

Copy link
Member

@wirew0rm wirew0rm left a comment

Choose a reason for hiding this comment

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

LGTM!
Very nice reproducer 👍

@RalphSteinhagen RalphSteinhagen merged commit 45ea2d1 into master Oct 30, 2020
@RalphSteinhagen RalphSteinhagen deleted the fixWeakHashMapMemoryLeak branch October 30, 2020 10:08
RalphSteinhagen added a commit that referenced this pull request Nov 5, 2020
…TickMark> - based cache implementation (#291)

See following references for details:
https://ewirch.github.io/2013/12/weakhashmap-memory-leaks.html
https://franke.ms/memoryleak1.wiki
N.B. latter author filed this as a bug at http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7145759 which was apparently dropped by Oracle devs as supposedly the intended behaviour for a WeakHashMap-based cache.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants