Package org.github.jamm
Class Filters
java.lang.Object
org.github.jamm.Filters
Utility class providing the different filters used by
MemoryMeter
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FieldFilter
Filter excluding some of the fields from sun.misc.Cleaner as they should not be taken into account.static final FieldAndClassFilter
Filter excluding class such asEnum
,Class
,ClassLoader
andAccessControlContext
static final FieldFilter
Filter excluding all the Reference's fields and thehead
field ofReferenceQueue
.static final FieldFilter
Filter excluding the outer class reference from non-static inner classes.static final FieldFilter
Filter excluding static and primitive fieldsstatic final FieldFilter
Filter excluding thegroup
field from thread classes as that field holds the references to all the other threads from the group to which the thread belongs.static final FieldAndClassFilter
Filter excluding fields and class annotated withUnmetered
-
Method Summary
Modifier and TypeMethodDescriptionstatic FieldAndClassFilter
getClassFilters
(boolean ignoreKnownSingletons) static FieldFilter
getFieldFilters
(boolean ignoreKnownSingletons, boolean ignoreOuterClassReference, boolean ignoreNonStrongReferences)
-
Field Details
-
IGNORE_STATIC_AND_PRIMITIVE_FIELDS
Filter excluding static and primitive fields -
IGNORE_KNOWN_SINGLETONS
Filter excluding class such asEnum
,Class
,ClassLoader
andAccessControlContext
-
IGNORE_NON_STRONG_REFERENCES
Filter excluding all the Reference's fields and thehead
field ofReferenceQueue
. The Reference fieldsnext
anddiscovered
are used byReferenceQueue
instances to create a linked list and are not part of what we want to measure. Thequeue
field is either a singletonReferenceQueue.NULL
or a provided queue that user hold a reference to and therefore should be ignored too. To be consistent, thehead
field ofReferenceQueue
is also ignored to fully decouple queue and references. -
IGNORE_CLEANER_FIELDS
Filter excluding some of the fields from sun.misc.Cleaner as they should not be taken into account. The fields being excluded are:- queue: as it is a dummy queue referenced by all Cleaner instances.
- next and prev: as they are used to create a doubly-linked list of live cleaners and therefore refer to other Cleaners instances
-
IGNORE_THREAD_FIELDS
Filter excluding thegroup
field from thread classes as that field holds the references to all the other threads from the group to which the thread belongs. -
IGNORE_OUTER_CLASS_REFERENCES
Filter excluding the outer class reference from non-static inner classes. In practice that filter is only useful if the top class is an inner class, and we wish to ignore the outer class in the measurement. -
IGNORE_UNMETERED_FIELDS_AND_CLASSES
Filter excluding fields and class annotated withUnmetered
-
-
Method Details
-
getClassFilters
-
getFieldFilters
public static FieldFilter getFieldFilters(boolean ignoreKnownSingletons, boolean ignoreOuterClassReference, boolean ignoreNonStrongReferences)
-