MediumConceptJVM, Memory and Performance
What are strong, soft, weak and phantom references?
What a good answer covers
Strong references prevent collection. Soft references are cleared under memory pressure, weak ones at the next collection once unreachable otherwise, and phantom ones are used for post-finalisation cleanup.
PreviousTwo threads update a shared counter and the total is sometimes wrong. How do you find and fix it?Next What causes a memory leak in a garbage-collected language?