Hi,

Maybe I didn't explain it very clearly, basically I have a code segment like
this:

LinkedList myMessages = new LinkedList();
int startPoint = 0;
.....

String message = aFirstName + "," + aLastName + ","+ aSex + "," + aComment;

while (message != null)
{
  myMessages.add(startPoint, message);
  startPoint++;
  if (startPoint == 100)
  {
     startPoint =0;
  }
  if (myMessages.size() > 100)
  {
     myMessages.remove(100);
  }
}
......

then I have some code to retrieve myMessages and pass it to the jsp page.
The problem is there are lots of messages dynamically, and my boss wants me
to refresh the jsp page every 10 seconds to reflect the newest messages. So
I have to add and remove the linkedlist fairly frequently.  After about 15
minutes, the program is getting slower and slower and finally it will die.
So I think that is because the removed messages are still in the memory and
the garbage collector can't clean them up to release the space.  I even
tried to add System.gc(); after myMessages.remove(100); but still the
problem is not solved.

Could anybody tell me what should I do?

Shirley




_____________________________________________________________________________________
Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to