Package org.bytedeco.javacpp
Class Pointer.DeallocatorReference
- java.lang.Object
-
- java.lang.ref.Reference<T>
-
- java.lang.ref.PhantomReference<Pointer>
-
- org.bytedeco.javacpp.Pointer.DeallocatorReference
-
- All Implemented Interfaces:
Pointer.Deallocator,Pointer.ReferenceCounter
- Direct Known Subclasses:
Pointer.CustomDeallocator,Pointer.NativeDeallocator,Pointer.ProxyDeallocator
- Enclosing class:
- Pointer
static class Pointer.DeallocatorReference extends java.lang.ref.PhantomReference<Pointer> implements Pointer.Deallocator, Pointer.ReferenceCounter
A subclass ofPhantomReferencethat also acts as a linked list to keep their references alive until they get garbage collected. Also keeps track of total allocated memory in bytes, to have it callSystem.gc()when that amount reachesPointer.maxBytes, and implements reference counting with anAtomicIntegercount.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) longbytes(package private) java.util.concurrent.atomic.AtomicIntegercount(package private) Pointer.Deallocatordeallocator(package private) static Pointer.DeallocatorReferencehead(package private) Pointer.DeallocatorReferencenext(package private) Pointer.DeallocatorReferenceprev(package private) static longtotalBytes(package private) static longtotalCount
-
Constructor Summary
Constructors Constructor Description DeallocatorReference(Pointer p, Pointer.Deallocator deallocator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidadd()voidclear()intcount()voiddeallocate()booleanrelease()(package private) voidremove()voidretain()java.lang.StringtoString()
-
-
-
Field Detail
-
head
static volatile Pointer.DeallocatorReference head
-
prev
volatile Pointer.DeallocatorReference prev
-
next
volatile Pointer.DeallocatorReference next
-
deallocator
Pointer.Deallocator deallocator
-
totalBytes
static volatile long totalBytes
-
totalCount
static volatile long totalCount
-
bytes
long bytes
-
count
java.util.concurrent.atomic.AtomicInteger count
-
-
Constructor Detail
-
DeallocatorReference
DeallocatorReference(Pointer p, Pointer.Deallocator deallocator)
-
-
Method Detail
-
add
final void add()
-
remove
final void remove()
-
clear
public void clear()
- Overrides:
clearin classjava.lang.ref.Reference<Pointer>
-
deallocate
public void deallocate()
- Specified by:
deallocatein interfacePointer.Deallocator
-
retain
public void retain()
- Specified by:
retainin interfacePointer.ReferenceCounter
-
release
public boolean release()
- Specified by:
releasein interfacePointer.ReferenceCounter
-
count
public int count()
- Specified by:
countin interfacePointer.ReferenceCounter
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-