我正在捕获jvm的内存数据,但是当我获取内存的数据(即元空间)时,我得到的是负值(
“ peakUsageMax”:-1, “ usageMax”:-1
)
我正在使用
ManagementFactory.getMemoryPoolMXBeans()
获取数据。我不知道为什么我要得到元数据的负面数据。难道我做错了什么? 我的数据是:
"Memory Data":[
{
"peakUsageMax":251658240,
"usageMax":251658240,
"peakUsageUsed":3136768,
"name":"Code Cache",
"peakUsageCommitted":3211264,
"usageUsed":3136768,
"type":"Non-heap memory",
"usageCommitted":3211264
},
{
"peakUsageMax":-1,
"usageMax":-1,
"peakUsageUsed":8491352,
"name":"Metaspace",
"peakUsageCommitted":8912896,
"usageUsed":8491352,
"type":"Non-heap memory",
"usageCommitted":8912896
},
{
"peakUsageMax":1073741824,
"usageMax":1073741824,
"peakUsageUsed":943688,
"name":"Compressed Class Space",
"peakUsageCommitted":1048576,
"usageUsed":943688,
"type":"Non-heap memory",
"usageCommitted":1048576
},
{
"peakUsageMax":680001536,
"usageMax":680001536,
"peakUsageUsed":14971840,
"name":"PS Eden Space",
"peakUsageCommitted":32505856,
"usageUsed":2600792,
"type":"Heap memory",
"usageCommitted":32505856
},
{
"peakUsageMax":5242880,
"usageMax":5242880,
"peakUsageUsed":2502552,
"name":"PS Survivor Space",
"peakUsageCommitted":5242880,
"usageUsed":0,
"type":"Heap memory",
"usageCommitted":5242880
},
{
"peakUsageMax":1381498880,
"usageMax":1381498880,
"peakUsageUsed":2332616,
"name":"PS Old Gen",
"peakUsageCommitted":87031808,
"usageUsed":1608248,
"type":"Heap memory",
"usageCommitted":87031808
}
]