Top Description Constructors Methods
com.carrotsearch.sizeof

public final Class BlackMagic

extends Object
Class Inheritance
Annotations
@SuppressWarnings:restriction
Imports
java.lang.reflect.Field, java.nio.ByteOrder, java.util.Locale, .Map, .TreeMap, sun.misc.Unsafe

This class contains black magic stuff based mostly on proprietary APIs and hacks. Use at your own risk.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String
fieldsLayoutAsString(Class<?> clazz)

Attempts to dump a layout of a class's fields in memory (offsets from base object pointer).

public static Unsafe
getUnsafe()

Returns Unsafe if available or throw a RuntimeException.

public static String
objectMemoryAsString(Object o)

Attempts to dump physical object's memory as a string.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

BlackMagicback to summary
public BlackMagic()

Method Detail

fieldsLayoutAsStringback to summary
public static String fieldsLayoutAsString(Class<?> clazz)

Attempts to dump a layout of a class's fields in memory (offsets from base object pointer).

Annotations
@SuppressWarnings:unchecked
getUnsafeback to summary
public static Unsafe getUnsafe()

Returns Unsafe if available or throw a RuntimeException.

objectMemoryAsStringback to summary
public static String objectMemoryAsString(Object o)

Attempts to dump physical object's memory as a string.