Is it normal for a java program to run at 60M or 90M?

By : shawn

I have a proxy server program which listens on a socket and creates a thread pool to process connections which come in spawning new threads if necessary to handle any additional overhead. When I start up the program on java 1.5 its memory footprint is 90M while if I use a java 1.6 jvm, it has a 60M footprint, this seems larger large for a simple proxy server program, is it normal?

I ask this because the system has rather limited memory and sometimes it throws OutOfMemoryException.

Above statistics are for when i start off with an initial thread pool size of less than 10. I I increase the initial thread pool size to 50, its memory footprint on jvm 1.5 is around 120M.

How can I reduce the memory usage?

By : shawn


You should use a tool that helps you analyze the memory requirements of your program.

You may want to look into jvisualvm, for example. You can watch memory allocations live or take a snapshot and analyse memory consumption on a class by class basis.

By : Ingo

It sounds fairly normal. If memory footprint is critical is it is worth trying different JVMs as they could be either more efficient or bloated. You could try decreasing the thread stack and TLAB allocation sizes to reduce the per thread overhead.

It is pretty common size. Obvious answer - use java 1.6 where you get lower memory footprint. To determine where your memory is gone, you will need to do profiling.

This video can help you solving your question :)
By: admin