When does the GC remove objects with only weak references?

I have a history-based Java application and it uses WeakReferences for caching. I made several heapdumps and saw that they all contain many objects with weak links (10% -15% of the heap size, ~ 1.2 GB).

  • Does this mean that weak links create memory pressure on the JVM?
  • And makes FullGC turn off the pause?

PS I know that WeakReference produces a performance limitation for GC for CMS, because it makes the algorithm more complicated. But did anyone see a document or some official information about this? I found only this SO post .

+4
source share
2 answers

Object Computing, Inc. , . :

  • SoftReference
  • GCed , , .
  • ,

WeakRefernence

  • GCed ,
  • " ", ( ), ""

" , get null-, - GCed."

: http://java.ociweb.com/mark/other-presentations/JavaGC.pdf

, SoftReference - .

API- Guava : https://github.com/google/guava/wiki/CachesExplained

+1

, JVM?

. GC. .

FullGC ?

.

+1

Source: https://habr.com/ru/post/1615630/