public class PowerOfTwoAllocator extends AATreeSet<org.terracotta.offheapstore.storage.allocator.Region>
This allocator allocates only power-of-two size chunks. In addition these chunks are then only allocated on alignment with their own size. Hence a chunk of 2n size can only be allocated to an address satisfying a=2nx where x is an integer.
| Modifier and Type | Class and Description |
|---|---|
static class |
PowerOfTwoAllocator.Packing |
AATreeSet.AbstractTreeNode<E extends Comparable<? super E>>, AATreeSet.Node<E extends Comparable<? super E>>| Constructor and Description |
|---|
PowerOfTwoAllocator(int size)
Create a power-of-two allocator with the given initial 'free' size area.
|
| Modifier and Type | Method and Description |
|---|---|
int |
allocate(int size,
PowerOfTwoAllocator.Packing packing) |
void |
claim(int address,
int size) |
int |
find(int size,
PowerOfTwoAllocator.Packing packing) |
org.terracotta.offheapstore.storage.allocator.Region |
find(Object o) |
void |
free(int address,
int length) |
int |
occupied() |
org.terracotta.offheapstore.storage.allocator.Region |
removeAndReturn(Object o) |
String |
toString() |
void |
tryFree(int address,
int length) |
add, clear, comparator, first, getRoot, headSet, isEmpty, iterator, last, remove, size, subSet, tailSetequals, hashCode, removeAlladdAll, contains, containsAll, retainAll, toArray, toArrayclone, finalize, getClass, notify, notifyAll, wait, wait, waitspliteratoraddAll, contains, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArrayparallelStream, removeIf, streampublic PowerOfTwoAllocator(int size)
size - initial free sizepublic int allocate(int size,
PowerOfTwoAllocator.Packing packing)
public void free(int address,
int length)
public void tryFree(int address,
int length)
public int find(int size,
PowerOfTwoAllocator.Packing packing)
public void claim(int address,
int size)
public int occupied()
public org.terracotta.offheapstore.storage.allocator.Region removeAndReturn(Object o)
removeAndReturn in class AATreeSet<org.terracotta.offheapstore.storage.allocator.Region>public org.terracotta.offheapstore.storage.allocator.Region find(Object o)
public String toString()
toString in class AbstractCollection<org.terracotta.offheapstore.storage.allocator.Region>Copyright © 2015–2024. All rights reserved.