You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/06/30 09:30:22 UTC

DO NOT REPLY [Bug 21176] New: - Continuous Memory Leaks

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21176>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21176

Continuous Memory Leaks

           Summary: Continuous Memory Leaks
           Product: Tomcat 4
           Version: 4.1.24
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Unknown
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: stefano.bertini@plangroup.it


I experiment frequent memory leaks using servlets with Tomcat.

As a simple test, i wrote this servlet:

import java.io.*;
import java.util.* ;

import javax.servlet.*;
import javax.servlet.http.*;

public class TestServlet extends HttpServlet {

  int liCount = 0 ;
    
  public void doGet(HttpServletRequest request, HttpServletResponse response) 
throws ServletException {

    try  {
    	Runtime lRuntime = Runtime.getRuntime();

    	StringBuffer lOut = new StringBuffer();
    	lOut.append("Loop,") ;
    	lOut.append((++liCount)) ;
    	lOut.append(",Total,") ;
    	lOut.append(lRuntime.totalMemory()) ;
    	lOut.append(",Used,") ;
    	lOut.append(lRuntime.totalMemory() - lRuntime.freeMemory()) ;
    	lOut.append(",Free,") ;
    	lOut.append(lRuntime.freeMemory()) ;  
        
    	System.out.println(lOut.toString());
    } catch (Exception ex)  {
    }
    
  }  

}

Examining the results, you can easily find out that memory usage keeps growing 
constantly.

Memory usage starts from 18.528.360 and, after about 10.000 iterations reaches 
32.509.816

Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org