Solved

Tomcat memory keep growing

Posted on 2001-07-26
4
497 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
4 Comments
 
LVL 3

Accepted Solution

by:
black earned 25 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 25 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java DateChooser? 3 36
javap bin 2 35
How to increase Spring boot/Tomcat max file upload size 2 75
Custom Java Application connects to database: Which one of the 20? 4 29
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This video teaches viewers about errors in exception handling.

803 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