What is the difference between Memory Usage and Heap Usage in my JVMMetrics ?

K

Krist

Hi all,

In my Apps Server console (OC4J) JVM Metrics, there are two columns
about memory :

Memory Usage (MB) -> Shows the amount of physical memory used by the
JVM.
Heap Usage (MB) -> Shows the amount of heap space used by the
JVM.

(heap usage seems to be up and down, but memory usage is never going
down, even when all user already loggout.)

What are the difference between the two ?

Thank you for your help,
xtanto
 
R

Roedy Green

(heap usage seems to be up and down, but memory usage is never going
down, even when all user already loggout.)

What are the difference between the two ?

Your variables you allocate with new go on the heap. Other memory use
includes the class files, the machine language equivalents of the
class files, the native code for the interpreter/hot spot.
 
A

Arne Vajhøj

In my Apps Server console (OC4J) JVM Metrics, there are two columns
about memory :

Memory Usage (MB) -> Shows the amount of physical memory used by the
JVM.
Heap Usage (MB) -> Shows the amount of heap space used by the
JVM.

(heap usage seems to be up and down, but memory usage is never going
down, even when all user already loggout.)

What are the difference between the two ?

I will guess that:

memory usage = memory the JVM has allocated from the OS

heap usage = memory your app has allocated from the JVM

With two points:

1) the JVM need memory for internal stuff so memory usage
is greater than heap usage
2) even if your app releases memory then the JVM may not
release it to the OS but keep it around just in case
you will need it again

Arne
 
K

Krist

I will guess that:

memory usage = memory the JVM has allocated from the OS

heap usage = memory your app has allocated from the JVM

With two points:

1) the JVM need memory for internal stuff so memory usage
    is greater than heap usage
2) even if your app releases memory then the JVM may not
    release it to the OS but keep it around just in case
    you will need it again

Arne

Hi sirs,
Thank you for your reply.

So, is it only the heap area that I can tune ? (GC & Memory leak)

How can I also tune the 'memory for internal stuff' usage ?

Thank you,
Krist
 
A

Arne Vajhøj

So, is it only the heap area that I can tune ? (GC& Memory leak)

How can I also tune the 'memory for internal stuff' usage ?

I don't think you have much control over what the JVM use for
itself and for byte code and JIT'ed code.

Arne
 
R

Roedy Green

How can I also tune the 'memory for internal stuff' usage ?

Try a variety of constellations of options and see which actually
works better. Bigger is not necessarily better. What is best depends
on your machine and what else in running in your machine at the time.
 
L

Lew

Read the documentation.

<http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html>
<http://java.sun.com/javase/6/docs/technotes/guides/vm/gc-ergonomics.html
<http://java.sun.com/performance/reference/whitepapers/tuning.html>

You can search java.sun.com with its search options, or use your favorite
search engine.

In addition to the various JVM options, how you code your programs affects
memory usage. Java is generally optimized for frequent creation of
short-lived objects, which supports a programming style of least-scoped
variables, a best practice anyway.
 
A

Arne Vajhøj

Read the documentation.

<http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html>
<http://java.sun.com/javase/6/docs/technotes/guides/vm/gc-ergonomics.html
<http://java.sun.com/performance/reference/whitepapers/tuning.html>

You can search java.sun.com with its search options, or use your
favorite search engine.

In addition to the various JVM options, how you code your programs
affects memory usage. Java is generally optimized for frequent creation
of short-lived objects, which supports a programming style of
least-scoped variables, a best practice anyway.

The 'memory for internal stuff' is all the memory except
the java variables in heap that gets GC'ed.

As far as I know there are very few options to control that.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top