static class Pointer.DeallocatorReference extends PhantomReference<Pointer> implements Pointer.Deallocator, Pointer.ReferenceCounter
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.| Modifier and Type | Field and Description |
|---|---|
(package private) long |
bytes |
(package private) AtomicInteger |
count |
(package private) Pointer.Deallocator |
deallocator |
(package private) static Pointer.DeallocatorReference |
head |
(package private) Pointer.DeallocatorReference |
next |
(package private) Pointer.DeallocatorReference |
prev |
(package private) static long |
totalBytes |
(package private) static long |
totalCount |
| Constructor and Description |
|---|
DeallocatorReference(Pointer p,
Pointer.Deallocator deallocator) |
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
add() |
void |
clear() |
int |
count() |
void |
deallocate() |
boolean |
release() |
(package private) void |
remove() |
void |
retain() |
String |
toString() |
getclone, enqueue, isEnqueuedstatic volatile Pointer.DeallocatorReference head
volatile Pointer.DeallocatorReference prev
volatile Pointer.DeallocatorReference next
Pointer.Deallocator deallocator
static volatile long totalBytes
static volatile long totalCount
long bytes
AtomicInteger count
DeallocatorReference(Pointer p, Pointer.Deallocator deallocator)
final void add()
final void remove()
public void deallocate()
deallocate in interface Pointer.Deallocatorpublic void retain()
retain in interface Pointer.ReferenceCounterpublic boolean release()
release in interface Pointer.ReferenceCounterpublic int count()
count in interface Pointer.ReferenceCounterCopyright © 2025. All rights reserved.