Solved

Tomcat memory keep growing

Posted on 2001-07-26
4
495 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mapAB Challlenge 35 128
Unable to start eclipse ? 17 134
more than one jdk and one jre 1 34
windows explorer path to command prompt 5 33
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

863 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now