ruds said:
I have also kept the session time out as 10 mins if the window is
idle.So [sic] that would handle the object references, is'nt?
Lew said:
Not necessarily. It depends on the lifetime of the references, which can
exceed request lifetime.
Please do not quote sigs.
How should I handle these object references?
Don't keep them around longer than needed. If an object is only needed for
request lifetime, don't store a reference to it in the session or application
context. If an object is only needed for session lifetime, don't store a
reference to it in the application context.
Once all references to an object go away, the object becomes unreachable and
its memory can be reclaimed by the garbage collector.
Java garbage collection (GC) disposes of unreferenced objects automatically as
it feels the need. All one needs to do to get rid of objects is make sure
that no references to them remain. It is a fairly common bug to have hidden
references, e.g., session variables or collection members, that keep objects
alive after the program is actually finished with them. This bug is called
"packratting", or informally, "memory leakage".
More than you wanted to know about Java garbage collection:
<
http://java.sun.com/javase/technologies/hotspot/gc/index.jsp>