Class PowerOfTwoAllocator

All Implemented Interfaces:
Iterable<Region>, Collection<Region>, SequencedCollection<Region>, SequencedSet<Region>, Set<Region>, SortedSet<Region>

public class PowerOfTwoAllocator extends AATreeSet<Region>
An augmented AA tree allocator with unusual alignment/allocation properties.

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.

  • Field Details

    • DEBUG

      private static final boolean DEBUG
    • VALIDATING

      private static final boolean VALIDATING
    • size

      private final int size
    • occupied

      private volatile int occupied
      This is volatile because we read it without any locking through UpfrontAllocatingPageSource.getAllocatedSizeUnSync()
  • Constructor Details

    • PowerOfTwoAllocator

      public PowerOfTwoAllocator(int size)
      Create a power-of-two allocator with the given initial 'free' size area.
      Parameters:
      size - initial free size
  • Method Details