Hi all,
I'm in mess with GC JDK 1.4.x log output. I'd like to read -besides GC information-
how much memory I have left and how much I'm using.
This is a small dump from the GC log:
976.578: [GC 976.578: [Tenured: 18115K->7153K(18116K), 0.3309426 secs] 19523K->7153K(19524K), 0.3459331 secs]
980.544: [GC 980.544: [Tenured: 18115K->8080K(18116K), 0.1734528 secs] 19523K->8080K(19524K), 0.1949907 secs]
982.783: [GC 982.783: [Tenured: 18115K->12388K(18116K), 0.1951404 secs] 19523K->12388K(19524K), 0.2119867 secs]
986.579: [GC 986.579: [Tenured: 20647K->8289K(20648K), 0.1755991 secs] 22311K->8289K(22312K), 0.1924510 secs]
From what I understand I have 8289K free memory and 22312K allocated.
At the meantime my application dumps Runtime.freeMemory() and.Runtime().totalMemory();
and numbers are quite different * about free memory *:
Free memory: 3'787'672
Total memory: 19'992'576
Free memory: 1'800'240
Total memory: 19'992'576
Free memory: 4'216'928
Total memory: 22'847'488
Free memory: 4'024'792
Total memory: 22'847'488
Does anybody know how to read free/total memory from GC's output ??
-
how to read free/total memory from GC's output ?? (5 messages)
- Posted by: fmarchioni fmarchioni
- Posted on: January 17 2005 03:20 EST
Threaded Messages (5)
- have a read of.. by Jason Frank on January 17 2005 16:42 EST
- Try the jvmstat and visualgc tools by Alex Chang on January 19 2005 11:52 EST
- dfgdfgdfg by Murali Bommireddy on January 24 2005 02:06 EST
- JDK 5.0 and JConsole may help you by Edmon Begoli on January 24 2005 11:34 EST
- dfgdfgdfg by Murali Bommireddy on January 24 2005 02:06 EST
- how to read free/total memory from GC's output ?? by Jose Ramon Huerga Ayuso on January 19 2005 13:56 EST
-
have a read of..[ Go to top ]
- Posted by: Jason Frank
- Posted on: January 17 2005 16:42 EST
- in response to fmarchioni fmarchioni
http://java.sun.com/docs/hotspot/gc1.4.2/
this will help you understand the verbosegc output - main point is that there is no such thing as just "free memory", there many memory spaces (Sun refers to them as generations), so it depends which one you're talking about. -
Try the jvmstat and visualgc tools[ Go to top ]
- Posted by: Alex Chang
- Posted on: January 19 2005 11:52 EST
- in response to fmarchioni fmarchioni
A super-easy way to look at memory usage and gc in java is by using the jvmstat and visualgc tools. See
GC in 1.4.2 - http://java.sun.com/docs/hotspot/gc1.4.2/index.html
Visual GC tool - http://java.sun.com/performance/jvmstat/visualgc.html
jvmstat - http://java.sun.com/performance/jvmstat/
You will need to install JDK 1.5 to get the tools to work ... but then you use it to monitor your 1.4 instance. -
dfgdfgdfg[ Go to top ]
- Posted by: Murali Bommireddy
- Posted on: January 24 2005 02:06 EST
- in response to Alex Chang
gdfgdfdfgdd -
JDK 5.0 and JConsole may help you[ Go to top ]
- Posted by: Edmon Begoli
- Posted on: January 24 2005 11:34 EST
- in response to Murali Bommireddy
JDK 5.0 JVM has much richer API, and good set of MBeans for capacity consumption monitoring. You can use MX4J or JConsole to interact with the MBeans.
Check this out:
http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html
Regards,
Edmon Begoli -
how to read free/total memory from GC's output ??[ Go to top ]
- Posted by: Jose Ramon Huerga Ayuso
- Posted on: January 19 2005 13:56 EST
- in response to fmarchioni fmarchioni
Hi all,I'm in mess with GC JDK 1.4.x log output. I'd like to read -besides GC information-how much memory I have left and how much I'm using.
You may try to ask to the garbage collector to provide you less information. If you merely add this parameter to the JVM...
-verbosegc
... you are going to get this kind of information, that is much more easy to be read:
[GC 46000 kb -> 24000 kb (0.010 sec]
[GC 48000 kb -> 26000 kb (0.020 sec]
[GC 49000 kb -> 23000 kb (0.015 sec]
[Full GC 50000 kb -> 12000 kb (0.470 sec]
This information is very easy to be understood. The first GC trace tells you that you had 46000 kb used, but that after 0.010 seconds of work, GC has freed 22000 kb. so you know have 24000 kb. used.
The second trace and the third are the same, and the last trace is a full gargage collection. This last process tends to be more costly for the CPU, but on the other hand, you get more available memory.
Hope this helps,
Jose Ramon Huerga
http://www.terra.es/personal/jrhuerga