Package org.omegat.util
Class MemoryUtils
- java.lang.Object
-
- org.omegat.util.MemoryUtils
-
public final class MemoryUtils extends java.lang.Object
Utils for calculate used memory. Calculation of object size is not perfect. It doesn't support multiple links to one object instance(object shares), memory alignments.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
calcObjectSize(java.lang.Object obj)
Calculate memory usage for object.static long
getMemoryAllocated()
Get memory allocated by jvm.static long
getMemoryLimit()
Get maximum memory which can be allocated by jvm.static long
getMemoryUsed()
Get memory which used by jvm.
-
-
-
Method Detail
-
getMemoryUsed
public static long getMemoryUsed()
Get memory which used by jvm.- Returns:
- memory size
-
getMemoryAllocated
public static long getMemoryAllocated()
Get memory allocated by jvm.- Returns:
- memory size
-
getMemoryLimit
public static long getMemoryLimit()
Get maximum memory which can be allocated by jvm.- Returns:
- memory size
-
calcObjectSize
public static long calcObjectSize(java.lang.Object obj)
Calculate memory usage for object.- Parameters:
obj
- object- Returns:
- memory size, or -1 if size is unknown
- Throws:
java.lang.Exception
-
-