Everyone knows about strong references in Java, few know about weak references as well. I was recently preparing for an interview and I wanted to read some more about weak references and found a really nice article about different types of references in Java. Well I was looking for 2 and i found 2 more , strong, weak, soft and phantom reference.
A very good article explaining different references , worth giving a look:
http://weblogs.java.net/blog/enicholas/archive/2006/05/understanding_w.html
Tuesday, June 24, 2008
Subscribe to:
Post Comments (Atom)
1 comment:
Excellent article!! Weak references can be extremely helpful especially in caching frameworks.
But generally we use various algorithms to manage memory constraints like FIFO or LFU ...
So it will be extremely useful if more info can be digged out on the order in which weak or phantom references are absorbed by garbage collector. Reason being.. when i am using such refernces, then anything in cache can disapper at any time; so before using it , i must knw for how much duration tht object will stay in memory ...
Post a Comment