JVM memory stats don't make sense to me - java

I'm trying to understand the output of various JVM memory diagnostics. First thing I do,
$ jcmd 27263 GC.heap_info
27263:
garbage-first heap total 29319168K, used 16150310K [0x00000000c3000000, 0x00000000c3806fd8, 0x00000007c0800000)
region size 8192K, 1132 young (9273344K), 8 survivors (65536K)
Metaspace used 457222K, capacity 526687K, committed 526848K, reserved 1507328K
class space used 50629K, capacity 68310K, committed 68352K, reserved 1048576K
So the used heap size is 16150310k/(1024^2) = 15.4GB. And now I do:
$ jstat -gc 27263
S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT
0.0 65536.0 0.0 65536.0 2547712.0 1736704.0 26705920.0 6794156.1 527104.0 457297.5 68352.0 50635.9 1876 212.356 0 0.000 212.356
And I add up S1U (S1 survivor space utilization), EU (Eden space utilization), OU (Old gen utilization): 65536.0 + 1736704.0 + 6794156.1 = 8,596,396.1K = 8.2GB.
What am I missing here? Why does Eden + survivor + Old gen ≠ heap?

Related

A fatal error has been detected by the Java Runtime Environment while using arithmetic exception in Mac [duplicate]

# A fatal error has been detected by the Java Runtime Environment:
#
# SIGFPE (0x8) at pc=0x000000010e6cb868, pid=4484, tid=0x0000000000002403
#
# JRE version: Java(TM) SE Runtime Environment (8.0_191-b12) (build 1.8.0_191-b12)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.191-b12 mixed mode bsd-amd64 compressed oops)
problem: # Problematic frame:
# j com.sun.tools.javac.comp.ConstFold.fold2(ILcom/sun/tools/javac/code/Type;Lcom/sun/tools/javac/code/Type;)Lcom/sun/tools/javac/code/Type;+877
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
#
--------------- T H R E A D ---------------
Current thread (0x00007f84eb009000): JavaThread "main" [_thread_in_Java, id=9219, stack(0x000000030485b000,0x000000030495b000)]
siginfo: si_signo: 8 (SIGFPE), si_code: 5 (FPE_FLTINV), si_addr: 0x000000010e6cb868
Registers:
RAX=0x0000000000000001, RBX=0x000000000000006c, RCX=0x0000000000000000, RDX=0x0000000000000000
RSP=0x00000003049581f0, RBP=0x0000000304958238, RSI=0x0000000304958190, RDI=0x00000007c0011570
R8 =0x00000007777abf28, R9 =0x00000007777abf08, R10=0x000000010d108120, R11=0x000000010f1071c0
R12=0x0000000000000000, R13=0x000000012c1db8c0, R14=0x0000000304958270, R15=0x00007f84eb009000
RIP=0x000000010e6cb868, EFLAGS=0x0000000000000a83, ERR=0x0000000000000000
TRAPNO=0x0000000000000000
Top of Stack: (sp=0x00000003049581f0)
0x00000003049581f0: 000000077506ece0 00000003049581f8
0x0000000304958200: 000000012c1db8bd 0000000304958270
0x0000000304958210: 000000012c1dc5c0 000000012cb95ea8
0x0000000304958220: 000000012c1dc150 0000000000000000
0x0000000304958230: 0000000304958280 000000077507da30
0x0000000304958240: 000000010feee024 00000006c1034b10
0x0000000304958250: 00000006c1028340 00000007777abf28
0x0000000304958260: 00000007777abf08 000000070000006c
0x0000000304958270: 000000077507fae0 000000010feee024
0x0000000304958280: 00000006c19afb80 000000010ea03894
0x0000000304958290: 00000007f805b996 000000077507da30
0x00000003049582a0: 00000007756f8658 0000000700000002
0x00000003049582b0: 000000077507fd90 00000007777abdd0
0x00000003049582c0: 000000077506ece0 00000007777a73b8
0x00000003049582d0: 00000007759d7228 0000000110346fb4
0x00000003049582e0: 000000077add8f08 0000000000000000
0x00000003049582f0: 00000007777abd40 00000007759d7228
0x0000000304958300: 00000000eea0faba 000000010fe7f374
0x0000000304958310: 000000000000000c 000000010fe7d65c
0x0000000304958320: 0000000000000000 00000007777abd40
0x0000000304958330: 00000007777abdf0 00000007777abd40
0x0000000304958340: 00000007777abd40 0000000000000030
0x0000000304958350: 00000007777abdf0 000000077507da30
0x0000000304958360: 0000000000000001 000000010e8134a4
0x0000000304958370: 00000000eeadf0cb 000000077507d5d0
0x0000000304958380: 00000007756f8748 000000077507da30
0x0000000304958390: 00000007756f8838 00000007777abf08
0x00000003049583a0: 00007f84eb009000 00007f84eb009000
0x00000003049583b0: 000000077507d5d0 00000007756f8748
0x00000003049583c0: 00000007777abf08 00000007777abf28
0x00000003049583d0: 00000000634e5337 00007f84eb009000
0x00000003049583e0: 00000007777abe88 000000011a46f000
Instructions: (pc=0x000000010e6cb868)
0x000000010e6cb848: c8 8b 04 24 48 83 c4 08 81 f8 00 00 00 80 0f 85
0x000000010e6cb858: 0b 00 00 00 33 d2 83 f9 ff 0f 84 03 00 00 00 99
0x000000010e6cb868: f7 f9 41 0f b6 5d 01 49 ff c5 49 ba 20 81 10 0d
0x000000010e6cb878: 01 00 00 00 41 ff 24 da 80 00 00 00 00 00 00 00
Register to memory mapping:
RAX=0x0000000000000001 is an unknown value
RBX=0x000000000000006c is an unknown value
RCX=0x0000000000000000 is an unknown value
RDX=0x0000000000000000 is an unknown value
RSP=0x00000003049581f0 is pointing into the stack for thread: 0x00007f84eb009000
RBP=0x0000000304958238 is pointing into the stack for thread: 0x00007f84eb009000
RSI=0x0000000304958190 is pointing into the stack for thread: 0x00007f84eb009000
RDI=0x00000007c0011570 is pointing into metadata
R8 =0x00000007777abf28 is an oop
com.sun.tools.javac.code.Type$JCPrimitiveType$1
- klass: 'com/sun/tools/javac/code/Type$JCPrimitiveType$1'
R9 =0x00000007777abf08 is an oop
com.sun.tools.javac.code.Type$JCPrimitiveType$1
- klass: 'com/sun/tools/javac/code/Type$JCPrimitiveType$1'
R10=0x000000010d108120: _ZN19TemplateInterpreter13_active_tableE+0x2000 in /Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/jre/lib/server/libjvm.dylib at 0x000000010c800000
R11=0x000000010f1071c0 is at entry_point+32 in (nmethod*)0x000000010f107050
R12=0x0000000000000000 is an unknown value
R13=0x000000012c1db8c0 is pointing into metadata
R14=0x0000000304958270 is pointing into the stack for thread: 0x00007f84eb009000
R15=0x00007f84eb009000 is a thread
Stack: [0x000000030485b000,0x000000030495b000], sp=0x00000003049581f0, free space=1012k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
j com.sun.tools.javac.comp.ConstFold.fold2(ILcom/sun/tools/javac/code/Type;Lcom/sun/tools/javac/code/Type;)Lcom/sun/tools/javac/code/Type;+877
J 6941 C1 com.sun.tools.javac.comp.Attr.visitBinary(Lcom/sun/tools/javac/tree/JCTree$JCBinary;)V (301 bytes) # 0x000000010feee024 [0x000000010feec100+0x1f24]
J 7646 C2 com.sun.tools.javac.tree.JCTree$JCBinary.accept(Lcom/sun/tools/javac/tree/JCTree$Visitor;)V (6 bytes) # 0x000000010f6abf24 [0x000000010f6abee0+0x44]
J 8325 C2 com.sun.tools.javac.comp.Attr.visitVarDef(Lcom/sun/tools/javac/tree/JCTree$JCVariableDecl;)V (406 bytes) # 0x000000010f61e620 [0x000000010f61d400+0x1220]
J 4996 C2 com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(Lcom/sun/tools/javac/tree/JCTree$Visitor;)V (6 bytes) # 0x000000010f5db2a4 [0x000000010f5db260+0x44]
J 8612 C2 com.sun.tools.javac.comp.Attr.visitBlock(Lcom/sun/tools/javac/tree/JCTree$JCBlock;)V (363 bytes) # 0x00000001103c7e54 [0x00000001103c7ae0+0x374]
J 5934 C2 com.sun.tools.javac.tree.JCTree$JCBlock.accept(Lcom/sun/tools/javac/tree/JCTree$Visitor;)V (6 bytes) # 0x000000010ea79f64 [0x000000010ea79f20+0x44]
J 7562 C2 com.sun.tools.javac.comp.Attr.attribStat(Lcom/sun/tools/javac/tree/JCTree;Lcom/sun/tools/javac/comp/Env;)Lcom/sun/tools/javac/code/Type; (11 bytes) # 0x000000010ecf3218 [0x000000010ecf3180+0x98]
j com.sun.tools.javac.comp.Attr.visitTry(Lcom/sun/tools/javac/tree/JCTree$JCTry;)V+246
J 7664 C1 com.sun.tools.javac.tree.JCTree$JCTry.accept(Lcom/sun/tools/javac/tree/JCTree$Visitor;)V (6 bytes) # 0x000000010f6c0fcc [0x000000010f6c0ec0+0x10c]
J 8612 C2 com.sun.tools.javac.comp.Attr.visitBlock(Lcom/sun/tools/javac/tree/JCTree$JCBlock;)V (363 bytes) # 0x00000001103c7e54 [0x00000001103c7ae0+0x374]
J 5934 C2 com.sun.tools.javac.tree.JCTree$JCBlock.accept(Lcom/sun/tools/javac/tree/JCTree$Visitor;)V (6 bytes) # 0x000000010ea79f64 [0x000000010ea79f20+0x44]
J 5637 C2 com.sun.tools.javac.comp.Attr.attribTree(Lcom/sun/tools/javac/tree/JCTree;Lcom/sun/tools/javac/comp/Env;Lcom/sun/tools/javac/comp/Attr$ResultInfo;)Lcom/sun/tools/javac/code/Type; (148 bytes) # 0x000000010f836ce0 [0x000000010f836c40+0xa0]
J 5891 C1 com.sun.tools.javac.comp.Attr.visitMethodDef(Lcom/sun/tools/javac/tree/JCTree$JCMethodDecl;)V (1198 bytes) # 0x000000010f94a49c [0x000000010f943400+0x709c]
J 5728 C2 com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(Lcom/sun/tools/javac/tree/JCTree$Visitor;)V (6 bytes) # 0x000000010edfeee4 [0x000000010edfeea0+0x44]
J 5637 C2 com.sun.tools.javac.comp.Attr.attribTree(Lcom/sun/tools/javac/tree/JCTree;Lcom/sun/tools/javac/comp/Env;Lcom/sun/tools/javac/comp/Attr$ResultInfo;)Lcom/sun/tools/javac/code/Type; (148 bytes) # 0x000000010f836ce0 [0x000000010f836c40+0xa0]
J 7951 C1 com.sun.tools.javac.comp.Attr.attribClassBody(Lcom/sun/tools/javac/comp/Env;Lcom/sun/tools/javac/code/Symbol$ClassSymbol;)V (726 bytes) # 0x000000010f35c94c [0x000000010f358b60+0x3dec]
J 6935 C1 com.sun.tools.javac.comp.Attr.attribClass(Lcom/sun/tools/javac/code/Symbol$ClassSymbol;)V (513 bytes) # 0x000000010fecef24 [0x000000010fecc760+0x27c4]
J 8135 C1 com.sun.tools.javac.comp.Attr.attribClass(Lcom/sun/tools/javac/util/JCDiagnostic$DiagnosticPosition;Lcom/sun/tools/javac/code/Symbol$ClassSymbol;)V (27 bytes) # 0x00000001101293c4 [0x00000001101292e0+0xe4]
j com.sun.tools.javac.comp.Attr.attrib(Lcom/sun/tools/javac/comp/Env;)V+36
J 8282 C1 com.sun.tools.javac.main.JavaCompiler.attribute(Lcom/sun/tools/javac/comp/Env;)Lcom/sun/tools/javac/comp/Env; (277 bytes) # 0x000000010fee7c5c [0x000000010fee5b60+0x20fc]
j com.sun.tools.javac.main.JavaCompiler.compile2()V+177
j com.sun.tools.javac.main.JavaCompiler.compile(Lcom/sun/tools/javac/util/List;Lcom/sun/tools/javac/util/List;Ljava/lang/Iterable;)V+165
j com.sun.tools.javac.main.Main.compile([Ljava/lang/String;[Ljava/lang/String;Lcom/sun/tools/javac/util/Context;Lcom/sun/tools/javac/util/List;Ljava/lang/Iterable;)Lcom/sun/tools/javac/main/Main$Result;+1299
j com.sun.tools.javac.api.JavacTaskImpl.doCall()Lcom/sun/tools/javac/main/Main$Result;+59
j com.sun.tools.javac.api.JavacTaskImpl.call()Ljava/lang/Boolean;+1
j org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess([Ljava/lang/String;Lorg/codehaus/plexus/compiler/CompilerConfiguration;[Ljava/lang/String;)Lorg/codehaus/plexus/compiler/CompilerResult;+129
j org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(Lorg/codehaus/plexus/compiler/CompilerConfiguration;)Lorg/codehaus/plexus/compiler/CompilerResult;+211
j org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute()V+3204
j org.apache.maven.plugin.compiler.TestCompilerMojo.execute()V+20
j org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Lorg/apache/maven/execution/MavenSession;Lorg/apache/maven/plugin/MojoExecution;)V+152
j org.apache.maven.lifecycle.internal.MojoExecutor.execute(Lorg/apache/maven/execution/MavenSession;Lorg/apache/maven/plugin/MojoExecution;Lorg/apache/maven/lifecycle/internal/ProjectIndex;Lorg/apache/maven/lifecycle/internal/DependencyContext;)V+215
j org.apache.maven.lifecycle.internal.MojoExecutor.execute(Lorg/apache/maven/execution/MavenSession;Lorg/apache/maven/plugin/MojoExecution;Lorg/apache/maven/lifecycle/internal/ProjectIndex;Lorg/apache/maven/lifecycle/internal/DependencyContext;Lorg/apache/maven/lifecycle/internal/PhaseRecorder;)V+6
j org.apache.maven.lifecycle.internal.MojoExecutor.execute(Lorg/apache/maven/execution/MavenSession;Ljava/util/List;Lorg/apache/maven/lifecycle/internal/ProjectIndex;)V+60
j org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(Lorg/apache/maven/execution/MavenSession;Lorg/apache/maven/execution/MavenSession;Lorg/apache/maven/lifecycle/internal/ReactorContext;Lorg/apache/maven/project/MavenProject;Lorg/apache/maven/lifecycle/internal/TaskSegment;)V+179
j org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(Lorg/apache/maven/execution/MavenSession;Lorg/apache/maven/lifecycle/internal/ReactorContext;Lorg/apache/maven/project/MavenProject;Lorg/apache/maven/lifecycle/internal/TaskSegment;)V+7
j org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(Lorg/apache/maven/execution/MavenSession;Lorg/apache/maven/lifecycle/internal/ReactorContext;Lorg/apache/maven/lifecycle/internal/ProjectBuildList;Ljava/util/List;Lorg/apache/maven/lifecycle/internal/ReactorBuildStatus;)V+77
j org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lorg/apache/maven/execution/MavenSession;)V+348
j org.apache.maven.DefaultMaven.doExecute(Lorg/apache/maven/execution/MavenExecutionRequest;Lorg/apache/maven/execution/MavenSession;Lorg/apache/maven/execution/MavenExecutionResult;Lorg/eclipse/aether/DefaultRepositorySystemSession;)Lorg/apache/maven/execution/MavenExecutionResult;+425
j org.apache.maven.DefaultMaven.doExecute(Lorg/apache/maven/execution/MavenExecutionRequest;)Lorg/apache/maven/execution/MavenExecutionResult;+98
j org.apache.maven.DefaultMaven.execute(Lorg/apache/maven/execution/MavenExecutionRequest;)Lorg/apache/maven/execution/MavenExecutionResult;+2
j org.apache.maven.cli.MavenCli.execute(Lorg/apache/maven/cli/CliRequest;)I+27
j org.apache.maven.cli.MavenCli.doMain(Lorg/apache/maven/cli/CliRequest;)I+66
j org.apache.maven.cli.MavenCli.main([Ljava/lang/String;Lorg/codehaus/plexus/classworlds/ClassWorld;)I+24
v ~StubRoutines::call_stub
V [libjvm.dylib+0x2ef9fe]
V [libjvm.dylib+0x4d6524]
V [libjvm.dylib+0x4d6a58]
V [libjvm.dylib+0x347f4c]
j sun.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0
j sun.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+100
j sun.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6
j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+56
j org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced([Ljava/lang/String;)V+45
j org.codehaus.plexus.classworlds.launcher.Launcher.launch([Ljava/lang/String;)V+2
j org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode([Ljava/lang/String;)I+101
j org.codehaus.plexus.classworlds.launcher.Launcher.main([Ljava/lang/String;)V+1
j org.codehaus.classworlds.Launcher.main([Ljava/lang/String;)V+1
v ~StubRoutines::call_stub
V [libjvm.dylib+0x2ef9fe]
V [libjvm.dylib+0x3269a5]
V [libjvm.dylib+0x31f731]
C [java+0x38c6] JavaMain+0x9c4
C [libsystem_pthread.dylib+0x6950] _pthread_start+0xe0
C [libsystem_pthread.dylib+0x247b] thread_start+0xf
C 0x0000000000000000
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x00007f84aa32d000 JavaThread "JGit-WorkQueue" daemon [_thread_blocked, id=15367, stack(0x0000000305ed5000,0x0000000305fd5000)]
0x00007f84aa98d000 JavaThread "process reaper" daemon [_thread_blocked, id=38247, stack(0x0000000305eaa000,0x0000000305ed2000)]
0x00007f84ebacd000 JavaThread "Attach Listener" daemon [_thread_blocked, id=40351, stack(0x0000000305da7000,0x0000000305ea7000)]
0x00007f84eb84f000 JavaThread "Service Thread" daemon [_thread_blocked, id=41231, stack(0x0000000305ba1000,0x0000000305ca1000)]
0x00007f84ea036800 JavaThread "C1 CompilerThread3" daemon [_thread_blocked, id=41475, stack(0x0000000305a9e000,0x0000000305b9e000)]
0x00007f84ea82a000 JavaThread "C2 CompilerThread2" daemon [_thread_in_native, id=41987, stack(0x000000030599b000,0x0000000305a9b000)]
0x00007f84ea81b800 JavaThread "C2 CompilerThread1" daemon [_thread_in_native, id=23299, stack(0x0000000305898000,0x0000000305998000)]
0x00007f84eb82e800 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=42755, stack(0x0000000305795000,0x0000000305895000)]
0x00007f84eb815800 JavaThread "Monitor Ctrl-Break" daemon [_thread_in_native, id=22599, stack(0x0000000305692000,0x0000000305792000)]
0x00007f84ea035800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=43267, stack(0x000000030558f000,0x000000030568f000)]
0x00007f84eb02b000 JavaThread "Finalizer" daemon [_thread_blocked, id=19227, stack(0x000000030537c000,0x000000030547c000)]
0x00007f84ea02b000 JavaThread "Reference Handler" daemon [_thread_blocked, id=19747, stack(0x0000000305279000,0x0000000305379000)]
=>0x00007f84eb009000 JavaThread "main" [_thread_in_Java, id=9219, stack(0x000000030485b000,0x000000030495b000)]
Other Threads:
0x00007f84ea02a800 VMThread [stack: 0x0000000305176000,0x0000000305276000] [id=14083]
0x00007f84eb06e800 WatcherThread [stack: 0x0000000305ca4000,0x0000000305da4000] [id=24603]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap:
PSYoungGen total 272896K, used 224430K [0x000000076ab00000, 0x0000000787880000, 0x00000007c0000000)
eden space 262144K, 81% used [0x000000076ab00000,0x0000000777bb1aa0,0x000000077ab00000)
from space 10752K, 99% used [0x000000077ab00000,0x000000077b57a0a8,0x000000077b580000)
to space 28672K, 0% used [0x0000000785c80000,0x0000000785c80000,0x0000000787880000)
ParOldGen total 132096K, used 37244K [0x00000006c0000000, 0x00000006c8100000, 0x000000076ab00000)
object space 132096K, 28% used [0x00000006c0000000,0x00000006c245f020,0x00000006c8100000)
Metaspace used 31490K, capacity 32580K, committed 32768K, reserved 1079296K
class space used 3483K, capacity 3806K, committed 3840K, reserved 1048576K
Card table byte_map: [0x000000011da6f000,0x000000011e270000] byte_map_base: 0x000000011a46f000
Marking Bits: (ParMarkBitMap*) 0x000000010d0f9e00
Begin Bits: [0x000000011e7c6000, 0x00000001227c6000)
End Bits: [0x00000001227c6000, 0x00000001267c6000)
Polling page: 0x00000001084d8000
CodeCache: size=245760Kb used=30069Kb max_used=30086Kb free=215690Kb
bounds [0x000000010e6af000, 0x000000011043f000, 0x000000011d6af000]
total_blobs=7493 nmethods=7063 adapters=344
compilation: enabled
Compilation events (10 events):
Event: 17.013 Thread 0x00007f84ea82a000 8678 4 com.sun.tools.javac.code.Type$UndetVar::addBound (9 bytes)
Event: 17.014 Thread 0x00007f84ea82a000 nmethod 8678 0x00000001103d5150 code [0x00000001103d52a0, 0x00000001103d5348]
Event: 17.015 Thread 0x00007f84ea036800 8679 3 com.sun.tools.javac.code.Types::glb (58 bytes)
Event: 17.016 Thread 0x00007f84ea036800 nmethod 8679 0x0000000110420b10 code [0x0000000110420d00, 0x00000001104216b8]
Event: 17.021 Thread 0x00007f84ea82a000 8680 % 4 com.sun.tools.javac.jvm.ClassWriter::writePool # 18 (1051 bytes)
Event: 17.023 Thread 0x00007f84ea036800 8682 3 com.sun.tools.javac.comp.DeferredAttr$DeferredAttrContext::insideOverloadPhase (35 bytes)
Event: 17.024 Thread 0x00007f84ea036800 nmethod 8682 0x0000000110416a50 code [0x0000000110416be0, 0x0000000110416f48]
Event: 17.031 Thread 0x00007f84eb82e800 nmethod 8676 0x0000000110431610 code [0x0000000110431980, 0x0000000110433160]
Event: 17.031 Thread 0x00007f84eb82e800 8681 4 com.sun.tools.javac.util.ListBuffer$1::next (39 bytes)
Event: 17.032 Thread 0x00007f84eb82e800 nmethod 8681 0x000000011042e610 code [0x000000011042e760, 0x000000011042e838]
GC Heap History (10 events):
Event: 2.640 GC heap before
{Heap before GC invocations=2 (full 0):
PSYoungGen total 76288K, used 74024K [0x000000076ab00000, 0x0000000774000000, 0x00000007c0000000)
eden space 65536K, 100% used [0x000000076ab00000,0x000000076eb00000,0x000000076eb00000)
from space 10752K, 78% used [0x000000076eb00000,0x000000076f34a230,0x000000076f580000)
to space 10752K, 0% used [0x0000000773580000,0x0000000773580000,0x0000000774000000)
ParOldGen total 175104K, used 0K [0x00000006c0000000, 0x00000006cab00000, 0x000000076ab00000)
object space 175104K, 0% used [0x00000006c0000000,0x00000006c0000000,0x00000006cab00000)
Metaspace used 15960K, capacity 16322K, committed 16640K, reserved 1064960K
class space used 1907K, capacity 2010K, committed 2048K, reserved 1048576K
Event: 2.679 GC heap after
Heap after GC invocations=2 (full 0):
PSYoungGen total 141824K, used 10750K [0x000000076ab00000, 0x0000000774000000, 0x00000007c0000000)
eden space 131072K, 0% used [0x000000076ab00000,0x000000076ab00000,0x0000000772b00000)
from space 10752K, 99% used [0x0000000773580000,0x0000000773fffb58,0x0000000774000000)
to space 10752K, 0% used [0x0000000772b00000,0x0000000772b00000,0x0000000773580000)
ParOldGen total 175104K, used 869K [0x00000006c0000000, 0x00000006cab00000, 0x000000076ab00000)
object space 175104K, 0% used [0x00000006c0000000,0x00000006c00d94d0,0x00000006cab00000)
Metaspace used 15960K, capacity 16322K, committed 16640K, reserved 1064960K
class space used 1907K, capacity 2010K, committed 2048K, reserved 1048576K
}
Event: 4.791 GC heap before
{Heap before GC invocations=3 (full 0):
PSYoungGen total 141824K, used 141822K [0x000000076ab00000, 0x0000000774000000, 0x00000007c0000000)
eden space 131072K, 100% used [0x000000076ab00000,0x0000000772b00000,0x0000000772b00000)
from space 10752K, 99% used [0x0000000773580000,0x0000000773fffb58,0x0000000774000000)
to space 10752K, 0% used [0x0000000772b00000,0x0000000772b00000,0x0000000773580000)
ParOldGen total 175104K, used 869K [0x00000006c0000000, 0x00000006cab00000, 0x000000076ab00000)
object space 175104K, 0% used [0x00000006c0000000,0x00000006c00d94d0,0x00000006cab00000)
Metaspace used 17900K, capacity 18352K, committed 18688K, reserved 1064960K
class space used 2052K, capacity 2219K, committed 2304K, reserved 1048576K
Event: 4.850 GC heap after
Heap after GC invocations=3 (full 0):
PSYoungGen total 141824K, used 10736K [0x000000076ab00000, 0x000000077c000000, 0x00000007c0000000)
eden space 131072K, 0% used [0x000000076ab00000,0x000000076ab00000,0x0000000772b00000)
from space 10752K, 99% used [0x0000000772b00000,0x000000077357c010,0x0000000773580000)
to space 10752K, 0% used [0x000000077b580000,0x000000077b580000,0x000000077c000000)
ParOldGen total 175104K, used 17569K [0x00000006c0000000, 0x00000006cab00000, 0x000000076ab00000)
object space 175104K, 10% used [0x00000006c0000000,0x00000006c11286d8,0x00000006cab00000)
Metaspace used 17900K, capacity 18352K, committed 18688K, reserved 1064960K
class space used 2052K, capacity 2219K, committed 2304K, reserved 1048576K
}
Event: 5.318 GC heap before
{Heap before GC invocations=4 (full 0):
PSYoungGen total 141824K, used 33411K [0x000000076ab00000, 0x000000077c000000, 0x00000007c0000000)
eden space 131072K, 17% used [0x000000076ab00000,0x000000076c124e60,0x0000000772b00000)
from space 10752K, 99% used [0x0000000772b00000,0x000000077357c010,0x0000000773580000)
to space 10752K, 0% used [0x000000077b580000,0x000000077b580000,0x000000077c000000)
ParOldGen total 175104K, used 17569K [0x00000006c0000000, 0x00000006cab00000, 0x000000076ab00000)
object space 175104K, 10% used [0x00000006c0000000,0x00000006c11286d8,0x00000006cab00000)
Metaspace used 20551K, capacity 21072K, committed 21248K, reserved 1069056K
class space used 2337K, capacity 2527K, committed 2560K, reserved 1048576K
Event: 5.342 GC heap after
Heap after GC invocations=4 (full 0):
PSYoungGen total 272896K, used 10720K [0x000000076ab00000, 0x000000077c000000, 0x00000007c0000000)
eden space 262144K, 0% used [0x000000076ab00000,0x000000076ab00000,0x000000077ab00000)
from space 10752K, 99% used [0x000000077b580000,0x000000077bff8040,0x000000077c000000)
to space 10752K, 0% used [0x000000077ab00000,0x000000077ab00000,0x000000077b580000)
ParOldGen total 175104K, used 19948K [0x00000006c0000000, 0x00000006cab00000, 0x000000076ab00000)
object space 175104K, 11% used [0x00000006c0000000,0x00000006c137b328,0x00000006cab00000)
Metaspace used 20551K, capacity 21072K, committed 21248K, reserved 1069056K
class space used 2337K, capacity 2527K, committed 2560K, reserved 1048576K
}
Event: 5.342 GC heap before
{Heap before GC invocations=5 (full 1):
PSYoungGen total 272896K, used 10720K [0x000000076ab00000, 0x000000077c000000, 0x00000007c0000000)
eden space 262144K, 0% used [0x000000076ab00000,0x000000076ab00000,0x000000077ab00000)
from space 10752K, 99% used [0x000000077b580000,0x000000077bff8040,0x000000077c000000)
to space 10752K, 0% used [0x000000077ab00000,0x000000077ab00000,0x000000077b580000)
ParOldGen total 175104K, used 19948K [0x00000006c0000000, 0x00000006cab00000, 0x000000076ab00000)
object space 175104K, 11% used [0x00000006c0000000,0x00000006c137b328,0x00000006cab00000)
Metaspace used 20551K, capacity 21072K, committed 21248K, reserved 1069056K
class space used 2337K, capacity 2527K, committed 2560K, reserved 1048576K
Event: 5.432 GC heap after
Heap after GC invocations=5 (full 1):
PSYoungGen total 272896K, used 0K [0x000000076ab00000, 0x000000077c000000, 0x00000007c0000000)
eden space 262144K, 0% used [0x000000076ab00000,0x000000076ab00000,0x000000077ab00000)
from space 10752K, 0% used [0x000000077b580000,0x000000077b580000,0x000000077c000000)
to space 10752K, 0% used [0x000000077ab00000,0x000000077ab00000,0x000000077b580000)
ParOldGen total 132096K, used 26302K [0x00000006c0000000, 0x00000006c8100000, 0x000000076ab00000)
object space 132096K, 19% used [0x00000006c0000000,0x00000006c19afb08,0x00000006c8100000)
Metaspace used 20551K, capacity 21072K, committed 21248K, reserved 1069056K
class space used 2337K, capacity 2527K, committed 2560K, reserved 1048576K
}
Event: 11.560 GC heap before
{Heap before GC invocations=6 (full 1):
PSYoungGen total 272896K, used 262144K [0x000000076ab00000, 0x000000077c000000, 0x00000007c0000000)
eden space 262144K, 100% used [0x000000076ab00000,0x000000077ab00000,0x000000077ab00000)
from space 10752K, 0% used [0x000000077b580000,0x000000077b580000,0x000000077c000000)
to space 10752K, 0% used [0x000000077ab00000,0x000000077ab00000,0x000000077b580000)
ParOldGen total 132096K, used 26302K [0x00000006c0000000, 0x00000006c8100000, 0x000000076ab00000)
object space 132096K, 19% used [0x00000006c0000000,0x00000006c19afb08,0x00000006c8100000)
Metaspace used 30715K, capacity 31812K, committed 32000K, reserved 1077248K
class space used 3451K, capacity 3742K, committed 3840K, reserved 1048576K
Event: 11.605 GC heap after
Heap after GC invocations=6 (full 1):
PSYoungGen total 272896K, used 10728K [0x000000076ab00000, 0x0000000787880000, 0x00000007c0000000)
eden space 262144K, 0% used [0x000000076ab00000,0x000000076ab00000,0x000000077ab00000)
from space 10752K, 99% used [0x000000077ab00000,0x000000077b57a0a8,0x000000077b580000)
to space 28672K, 0% used [0x0000000785c80000,0x0000000785c80000,0x0000000787880000)
ParOldGen total 132096K, used 37244K [0x00000006c0000000, 0x00000006c8100000, 0x000000076ab00000)
object space 132096K, 28% used [0x00000006c0000000,0x00000006c245f020,0x00000006c8100000)
Metaspace used 30715K, capacity 31812K, committed 32000K, reserved 1077248K
class space used 3451K, capacity 3742K, committed 3840K, reserved 1048576K
}
I've fixed the same issue by changing the JDK from the Oracle version to the Zulu one.
You can download the ARM-64 supported JDK 8 built by Zulu from the following link:
https://www.azul.com/downloads/zulu-community/?version=java-8-lts&os=macos&architecture=arm-64-bit&package=jdk
Reference: https://stackoverflow.com/a/64788161/2906153

-Xms option seems to ignored on gke but -Xmx is working

I'm running java application(ksqldb 0.15.0) on GKE cluster, and passed the java opts -Xms3G and -Xmx5G.
-Xmx option is working well, but -Xms options seems not to be effected.
The running command is as follows;
java -cp /usr/share/java/ksqldb-rest-app/*: -Xms3G -Xmx5G -server -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+CMSScavengeBeforeRemark -XX:+ExplicitGCInvokesConcurrent -XX:NewRatio=1 -Djava.awt.headless=true -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dksql.log.dir=/usr/logs -Dlog4j.configuration=file:/etc/ksqldb/log4j.properties -Dksql.server.install.dir=/usr -Xlog:gc*:file=/usr/logs/ksql-server-gc.log:time,tags:filecount=10,filesize=102400 io.confluent.ksql.rest.server.KsqlServerMain /etc/ksqldb/ksqldb-server.properties
To investigate, I issued jstat command, and the result was like below;
NGCMN
NGCMX
NGC
S0C
S1C
EC
OGCMN
OGCMX
OGC
OC
MCMN
MCMX
MC
CCSMN
CCSMX
CCSC
YGC
FGC
CGC
192
2621440
1572864
157248
157248
1258368
64
2621440
1572864
1572864
0
1163264
132268
0
1048576
18828
505
0
4
Expected value of the sum of NGCMN + OGCMN is 3145728 (=3GB), but the actual value is 256.
However, the sum of NGCMX + OGCMX is 5242880(=5GB), so -Xmx options is correctly effected.
The Host that the pod is running on has 15GB of physical memories.
Am I missing something?
-Xms sets the initial heap size, not the minimum size.
NGCMN and OGCMN denote the minimum capacity of the new generation and the old generation respectively. These numbers are useless most of the time. What you probably wanted to look at is NGC/OGC - the current capacity of the new generation and the old generation.
You've set -Xms3G, and the current heap size is exactly
NGC + OGC = 1572864 + 1572864 KB = 3 GB

Why does JVM allocated Heap size increase after heap dump?

I'm monitoring a JVM process and I notice every time I perform a heap-dump it increases my allocated heap size to that application. This is certainly not expected and it's not something I want when I do a heap dump. What is the reason and is there a way to prevent it?
For example, if I check jstat before Heap dump here is what I get:
S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT
52224.0 54784.0 0.0 0.0 519680.0 396674.9 10765824.0 75678.9 65920.0 62151.2 8576.0 7827.8 8 0.057 7 1.776 1.832
I do a Heap dump using jcmd:
jcmd <pid> GC.heap_dump heap.bin
and check jstat again it looks like heap size allocated has increased (looking at OC column):
S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT
52224.0 54784.0 0.0 0.0 519680.0 45402.9 13836800.0 75711.1 65920.0 62168.7 8576.0 7830.9 9 0.060 8 1.944 2.004
I confirm I see the same thing in Java VisualVM (each step up is after a heap dump):
I've found I can get a heap dump without this increase when I use jmap command without the live option. But why does this happen in the first place?

Why is there a difference between heap dump and live heap size?

I am trying to find analyze the heap memory for my application using sudo watch -d -n1 jstat -gc 2342 it shows as 4GB heap size:
S0C S1C S0U S1U EC EU OC OU
18432.0 17920.0 7736.5 0.0 1711104.0 638785.9 3495424.0 831624.7
MC MU CCSC CCSU YGC YGCT FGC FGCT GCT
447616.0 185520.7 80512.0 23790.2 67039 2248.559 62 111.219 2359.778
But when I took a heap dump using the command
jmap -dump:live,format=b,file=/tmp/dump.hprof 12587, I see the size of the dump as less than a GB. Any reason why this could happen?

JVM with -Xmx500m actually consumes 1GB of memory

I'm trying to host Swing Java application for a lengthy period on VPS at "always-on" mode and am willing to fit it into 1GB shape (Ubuntu as host OS).
Application is started with "-Xmx500m -XX:+UseConcMarkSweepGC" and it seems reasonable that it should fit (with all other supplementary staff) into 1GB of total RAM, but ... after running application for 2-3 days top says that java application alone eats almost 1GB (see USED column) - it is twice more than specified "-Xmx500m":
KiB Mem : 1009136 total, 66084 free, 867128 used, 75924 buff/cache
KiB Swap: 716796 total, 9388 free, 707408 used. 28472 avail Mem
PID VIRT RES SWAP USED SHR S %CPU %MEM TIME+ COMMAND
2401 3076084 529648 467832 997480 1900 S 31.0 52.5 916:05.68 java
2218 285544 37548 74720 112268 8800 S 6.9 3.7 269:12.60 Xvnc4
2388 709104 11448 9744 21192 7760 S 6.9 1.1 24:45.88 mate-terminal
883 643820 10932 2540 13472 5624 S 0.0 1.1 1:48.43 do-agent
2327 544648 4092 5992 10084 2436 S 3.4 0.4 6:38.31 clock-applet
Actual 'Heap usage' within application is around 350MB (displayed by application itself).
From jstat -gc 2401 I see usage only of around 630MB. Where are other ~360MB? What I'm missing? Is it possible to reduce memory usage via some JVM options?
S0C S1C S0U S1U EC EU OC OU
8512.0 8512.0 0.0 2161.2 68160.0 67668.5 426816.0 249483.9
MC MU CCSC CCSU YGC YGCT FGC FGCT GCT
112464.0 108027.1 14160.0 13222.6 48701 1484.856 124 590.113 2074.968
https://docs.oracle.com/javase/8/docs/technotes/tools/unix/jstat.html
S0C - Current survivor space 0 - 8MB
S1C - Current survivor space 1 - 8MB
EU - Current eden space capacity - 68 MB
OC - Current old space capacity - 426 MB
MC - Metaspace capacity - 112 MB
CCSC - Compressed class space capacity - 14 MB
--> 636 MB
USED is the sum of RES + SWAP.
You only have +500Mb in your real memory, and +400Mb in the swap so it's the normal behaviour.
Here is the manual of top and more explanations about the swap.

Categories