Package org.bytedeco.javacpp
Class 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 PhantomReference<Pointer>
implements Pointer.Deallocator, Pointer.ReferenceCounter
A subclass of
PhantomReference
that 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
call System.gc()
when that amount reaches Pointer.maxBytes
,
and implements reference counting with an AtomicInteger
count.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) long
(package private) AtomicInteger
(package private) Pointer.Deallocator
(package private) static Pointer.DeallocatorReference
(package private) Pointer.DeallocatorReference
(package private) Pointer.DeallocatorReference
(package private) static long
(package private) static long
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.ref.PhantomReference
get
Methods inherited from class java.lang.ref.Reference
clone, enqueue, isEnqueued, reachabilityFence, refersTo
-
Field Details
-
head
-
prev
-
next
-
deallocator
Pointer.Deallocator deallocator -
totalBytes
static volatile long totalBytes -
totalCount
static volatile long totalCount -
bytes
long bytes -
count
AtomicInteger count
-
-
Constructor Details
-
DeallocatorReference
DeallocatorReference(Pointer p, Pointer.Deallocator deallocator)
-
-
Method Details
-
add
final void add() -
remove
final void remove() -
clear
public void clear() -
deallocate
public void deallocate()- Specified by:
deallocate
in interfacePointer.Deallocator
-
retain
public void retain()- Specified by:
retain
in interfacePointer.ReferenceCounter
-
release
public boolean release()- Specified by:
release
in interfacePointer.ReferenceCounter
-
count
public int count()- Specified by:
count
in interfacePointer.ReferenceCounter
-
toString
-