top res is bigger more than Xmx

Viewed 694

env:jdk8
Garbage: g1

jvm paras: -Xms30G -Xmx30G -XX:MaxDirectMemorySize=1G -XX:MetaspaceSize=500m -XX:MaxMetaspaceSize=1G

The program runs for long times top command notice the Res is 60G or more。I want to know the reason for this problem. Who's ever had a problem like that? help me

1 Answers

-Xmx is the maximum heap size. It is not the maximum process size. You are using other resources like threads, sockets, GUI, direct memory, shared libraries, metaspace, memory mapped files.

I would have said; Direct memory is the most likely, esp as it's maximum size is the same as the heap by default, however as @apangin points out you have set the maximum to 1 GB.

I don't know of an easy way to find how much direct memory is used, however on an Oracle JVM you can obtain java.nio.Bits#reservedMemory as it has the amount allocated currently.

Related