encyclopegia.org

Soft reference

A soft reference is a reference that is garbage-collected less aggressively. The class is java.lang.ref.SoftReference . The soft reference is one of the strengths or levels of 'non strong' reference defined in the Java programming language, the others being weak and phantom. In order from strongest to weakest, they are: strong, soft, weak, phantom. Soft references behave almost identically to weak references. Soft and weak references provide two quasi-priorities for non-strongly referenced objects: the garbage collector will always collect weakly referenced objects, but will only collect softly referenced objects when its algorithms decide that memory is low enough to warrant it. Soft references may be used, for example, to write a free memory sensitive cache such that cached objects are kept until there is not enough heap space. In some cases weakly referenced objects may be reclaimed too quickly to make such a cache useful.

A soft reference is a reference that is garbage-collected less aggressively. The class is java.lang.ref.SoftReference . The soft reference is one of the strengths or levels of 'non strong' reference defined in the Java programming language, the others being weak and phantom. In order from strongest to weakest, they are: strong, soft, weak, phantom. Soft references behave almost identically to weak references. Soft and weak references provide two quasi-priorities for non-strongly referenced objects: the garbage collector will always collect weakly referenced objects, but will only collect softly referenced objects when its algorithms decide that memory is low enough to warrant it. Soft references may be used, for example, to write a free memory sensitive cache such that cached objects are kept until there is not enough heap space. In some cases weakly referenced objects may be reclaimed too quickly to make such a cache useful.

References

No reference rows published for this article.

Cite this article

MLA

"Soft reference." encyclopegia.org, 2025, https://encyclopegia.org/wiki/soft-reference. Accessed 24 November 2026.

Chicago

"Soft reference." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/soft-reference.

APA

encyclopegia.org. (2025). Soft reference. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/soft-reference

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Phantom reference

enwiki · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1310955419 · 0.5 · snapshot enwiki-001310955419

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.