Find the answer to your Linux question:
Results 1 to 4 of 4
i have been tasked with monitoring the java heap via an automated script. Is there something simple that can run via a shell script or perl script? I am not ...
  1. #1
    Just Joined!
    Join Date
    Apr 2009
    Posts
    3

    Monitoring Java Heap

    i have been tasked with monitoring the java heap via an automated script. Is there something simple that can run via a shell script or perl script? I am not worried about a lot of output to parse, I just cant seem to find something to generate the output.

    Thanks,
    B

  2. #2
    Linux Engineer Thrillhouse's Avatar
    Join Date
    Jun 2006
    Location
    Arlington, VA, USA
    Posts
    1,377
    Since all Java programs are run in the JVM, and are mostly hidden from the underlying operating system, it would probably be difficult to write a shell script to profile the heap and/or JVM. Instead, I would recommend using one of the profiling tools that are available for most Java IDEs. I use HeapWalker for Netbeans which can break things down by class or instance. You can also use some of the more generic profiling tools that come with the IDE.

  3. #3
    Linux Engineer Thrillhouse's Avatar
    Join Date
    Jun 2006
    Location
    Arlington, VA, USA
    Posts
    1,377
    Here's a snapshot of the Netbeans memory profiler I just took of some code I'm working on (this isn't HeapWalker). As you can see, it shows you how many bytes and objects are allocated for each class/primitive. And you can't tell from this picture but, the IDE allows you to filter on class name.

    EDIT: Sorry about the image quality. It was a png and looked fine on my machine; not sure why the forums converted it to a jpg and compressed it down.
    Attached Images Attached Images

  4. #4
    Just Joined!
    Join Date
    Apr 2009
    Posts
    3
    yeah, i really need something that I can parse and send to a monitoring system. Is there some kind of commandline jconsole that will just send raw output?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...