public class ObjectSizeProvider extends java.lang.Object implements IObjectSizeProvider
| Modifier and Type | Field and Description |
|---|---|
private static IObjectSizeProvider |
instance
Stores the singleton instance.
|
| Constructor and Description |
|---|
ObjectSizeProvider() |
| Modifier and Type | Method and Description |
|---|---|
private static IObjectSizeProvider |
createDefaultProvider()
Creates the default provider.
|
static IObjectSizeProvider |
getInstance()
Returns the singleton instance allowing access to object sizes.
|
long |
getObjectSize(java.lang.Object object)
Returns the size of the given object as allocated by the JVM.
|
static void |
setInstance(IObjectSizeProvider newInstance)
Changes the singleton instance (may be done by the instrumentation Agent).
|
private static IObjectSizeProvider instance
private static IObjectSizeProvider createDefaultProvider()
public static final void setInstance(IObjectSizeProvider newInstance)
newInstance - the new singleton instance (must not be null).java.lang.IllegalArgumentException - in case that
newInstance==nullpublic static final IObjectSizeProvider getInstance()
public long getObjectSize(java.lang.Object object)
getObjectSize in interface IObjectSizeProviderobject - the object the size should be queried forobject
(in bytes, negative or zero if invalid or not available,
always 0)