問題タブ [soft-references]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - Soft Reference in the role of GC in java
Recently I come across this article which does the GC tuning the Jenkins which talks about this paramter : -XX:SoftRefLRUPolicyMSPerMB
https://jenkins.io/blog/2016/11/21/gc-tuning/
I understand it prevents OOM error, Because it clears the Soft reference object when it reaches to the threshold.
1) What is this threshold (default = 1000ms in -XX:SoftRefLRUPolicyMSPerMB) means? What does this value denotes?
2) My jenkins seems to have 80% of the softreference (observed using HProf)
3) As suggested in the above article, If I reduce this -XX:SoftRefLRUPolicyMSPerMB flag to 10ms What will be consequence?
NOTE : We use G1GC
Thanks,
Harry
java - ソフトリーチブルオブジェクトとは?
この「Java のソフト参照」の記事で、ソフト参照の意味を調べようとしています。
https://www.baeldung.com/java-soft-references
この記事を理解する上での問題は、「ソフト参照」という用語を「ソフトに到達可能なオブジェクト」という用語で定義していることですが、「ソフトに到達可能なオブジェクト」が何を意味するのかわかりません。
つまり、ヒープ内のオブジェクトは、それへの参照を持っているか持っていないかのどちらかですよね?
参照は有効なオブジェクトを指しているか、null ですよね?
オブジェクトが「そっと到達可能」になるのはいつですか?
または私はそれをすべて間違っていましたか?
java - HashMap implementation with the soft referenced values
I wanted to have a Map with key mapping to quite a big object.
Since the map is going to be used as a cache, I wanted to make the values/entries referenced via soft links (java.lang.ref.SoftReference
) to clear it on pure memory. But in this case, I need to have my own implementation of computeIfAbsent()
method.
I could implement it in the following way:
Just wanted to know, is there an out of the box solution for such a Map, like java.util.WeakHashMap
?
Thanks!