File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Linux / UNIX and the fly likes Linux memory usage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Linux memory usage" Watch "Linux memory usage" New topic

Linux memory usage

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
Hi guys,

Just wondering if there is a Linux command or functionality that would allow me to see what is using my Servers memory, in more details.

I know from # top shows me that Tomcat is allocating 20gb (VIRT) and using about 8gb RAM, but is there a way I can drill down further to see what Tomcat is actually using this 20gb and 8gb for?

This is a legacy application I have inherited therefore I have no idea what is going on deep down in the thousounds of lines of code in the 1500+ classes, but as soon as I start Tomcat the VIRT is at 20gb and RAM at 8gb and within a day I'm getting OutOfMemory errors.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

Linux doesn't know or care what goes on inside of Tomcat or any other JVM-based application. As far as Linux is concerned, a big chunk of virtual memory has been allocated for Tomcat to use, and what Tomcat does with it is Tomcat's business.

To find out how memory is being used inside of Tomcat, you'll need to use JVM memory-management tools such as the memory profiler that comes with the JDK, the jprofile app that taps into Tomcat's MBeans and similar such diagnostic aids.

An IDE is no substitute for an Intelligent Developer.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15091

One very useful tool included in the JDK to check what's happening inside Java processes is jvisualvm.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: Linux memory usage
It's not a secret anymore!