public static class Debug.HeapInfo extends Object
You can use the Debug#getNativeHeapInfo method to obtain the statistics about the native heap memory.
Example code for obtaining the statistics about the native heap memory:
Debug.HeapInfo heapInfo =new Debug.HeapInfo();
Debug.getNativeHeapInfo(heapInfo);
long heapSize = heapInfo.nativeHeapSize ;
long allocateHeapSize = heapInfo.nativeHeapAllocatedSize;
long freeHeapSize = heapInfo.nativeHeapFreeSize;
| 限定符和类型 | 字段 | 说明 |
|---|---|---|
long |
nativeHeapAllocatedSize |
Indicates the amount of allocated memory for the static native heap used by the current process.
|
long |
nativeHeapFreeSize |
Indicates the amount of free memory for the static native heap used by the current process.
|
long |
nativeHeapSize |
Indicates the total amount of static native heap memory used by the current process.
|
| 构造器 | 说明 |
|---|---|
HeapInfo() |
public long nativeHeapAllocatedSize
The allocated memory is stored in bytes, and its amount must be greater than 0.
public long nativeHeapFreeSize
The free memory is saved in bytes, and its amount must be greater than 0.
public long nativeHeapSize
The total memory is stored in bytes, and its amount must be greater than 0.