Solved

Tomcat memory keep growing

Posted on 2001-07-26
4
492 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
copyEndy  challenge 15 54
Books that can get me started on JAVA 2 52
Image decoding from Camera 3 42
github account with ecipse 1 15
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This video teaches viewers about errors in exception handling.

763 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

9 Experts available now in Live!

Get 1:1 Help Now