Interface Sampler
public interface Sampler
This interface describes a function that is used to sample an allocation.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
sampleAllocation
(int count, String desc, Object newObj, long size) Determines whether the object currently being allocated, with the given size, should be traced.
-
Method Details
-
sampleAllocation
Determines whether the object currently being allocated, with the given size, should be traced. CAUTION: DO NOT DO ALLOCATION IN THIS METHOD WITHOUT ENSURING THAT THE SAMPLER WILL NOT BE INVOKED ON THE RESULTING ALLOCATION. Otherwise, you will get an infinite regress of calls to the sampler.- Parameters:
count
- theint
count of how many instances are being allocated. -1 means a simple new to distinguish from a 1-element array. 0 shows up as a value here sometimes; one reason is T[] toArray()-type methods that require an array type argument (see ArrayList.toArray() for example).desc
- theString
descriptor of the class/primitive type being allocated.newObj
- the newObject
whose allocation we're recording.size
- the size of the object being allocated.
-