?
Solved

Tomcat memory keep growing

Posted on 2001-07-26
4
Medium Priority
?
505 Views
Last Modified: 2013-11-24
win2000/Tomcat/Apache

My situation is once I invoke a servlet, java.exe occupy more memory (from Task Manager). Normal right? But after the servlet done, memory does not be free.
i.e. java.exe memory usage keep growing.

the servlet involves fileoutputstream, printstream and file. I have closed the former two. But I don't know how to close the file.
i.e. I open the file but do not close it.
I think the memory leak problem may due to this.

Anyone please advise what is the problem? or I missed some settings in Tomcat...

Thanks
0
Comment
Question by:win97a
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 3

Accepted Solution

by:
black earned 100 total points
ID: 6325078
The file object does not need to be closed, only the streams i.e. your fileoutputstream and printstream.
I assume you are reading the input from the file and storing them as String objects, this tends to be a common cause of memory growth. If you have a profiler of the JVM try to get an object count and see which objects keep growing, I've experienced situations where due to debugging or reading file input the number of String objects keeps growing and uses up a lot of the memory.
Try using StringBuffers where you can and see if the memory usage declines.
0
 
LVL 1

Assisted Solution

by:googlyralph
googlyralph earned 100 total points
ID: 6327215
Hi,

a problem i was made aware of due to a freind working on tomcat is that there is a known memory leak on jdk1.3.1 this may account for your troubles? (assuming you are running 1.3.1 that is... ;-)

Googly Ralph.
0
 

Expert Comment

by:CleanupPing
ID: 9061952
win97a:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 9208315
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:


[split points between googlyralph and black]


Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
sudhakar_koundinya
EE Cleanup Volunteer
---------------------
If you feel that your question was not properly addressed, or that none of the comments received were appropriate answers, please post your concern in THIS thread.
0

Featured Post

What is a Denial of Service (DoS)?

A DoS is a malicious attempt to prevent the normal operation of a computer system. You may frequently see the terms 'DDoS' (Distributed Denial of Service) and 'DoS' used interchangeably, but there are some subtle differences.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month9 days, 5 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question