public static final class MemoryUtils.OffHeapDetector
extends java.lang.Object
MemoryUtils.Tracked
objects (emulating off heap objects)
are explicitly released.构造器和说明 |
---|
OffHeapDetector() |
限定符和类型 | 方法和说明 |
---|---|
void |
assertNoLeaks()
Assert that all currently tracked objects have been
released . |
void |
reset()
Reset this tracker, clearing the queue of tracked objects (which can be useful eg. when
looping multiple times in order to test race conditions).
|
MemoryUtils.Tracked |
track(int identifier)
Create a
MemoryUtils.Tracked object from an int id, for convenience. |
MemoryUtils.Tracked |
track(java.lang.String identifier)
Create a
MemoryUtils.Tracked object with the given String identifier. |
long |
trackedTotal()
Return the total number of tracked objects so far.
|
public final MemoryUtils.Tracked track(java.lang.String identifier)
MemoryUtils.Tracked
object with the given String
identifier.identifier
- the identifier for the tracked objectpublic final MemoryUtils.Tracked track(int identifier)
MemoryUtils.Tracked
object from an int id, for convenience.identifier
- the identifier for the tracked objectpublic final long trackedTotal()
public void assertNoLeaks()
released
.
Note that the MemoryUtils.Tracked
object has a custom AssertJ representation (otherwise it
would be represented as an AtomicBoolean
). It is automatically registered in
AssertionsUtils
whenever an MemoryUtils.OffHeapDetector
is instantiated.
public void reset()