Class PagePool

java.lang.Object
org.apache.ignite.internal.pagemem.PagePool

public class PagePool extends Object
  • Field Details

    • REL_PTR_NUM_BITS

      public static final int REL_PTR_NUM_BITS
      Number of lower bits which a relative page address may occupy. Must be less than or equal to 32.
      See Also:
    • REL_PTR_MASK

      public static final long REL_PTR_MASK
      Relative pointer mask
      See Also:
    • INVALID_REL_PTR

      public static final long INVALID_REL_PTR
      Relative null pointer
      See Also:
    • region

      protected final DirectMemoryRegion region
      Direct memory region.
    • pagesCntr

      protected final AtomicInteger pagesCntr
      Pool pages counter.
    • lastAllocatedIdxPtr

      protected long lastAllocatedIdxPtr
    • freePageListPtr

      protected long freePageListPtr
      Pointer to the address of the free page list.
    • pagesBase

      protected long pagesBase
      Pages base.
  • Constructor Details

  • Method Details

    • borrowOrAllocateFreePage

      public long borrowOrAllocateFreePage(int tag) throws GridOffHeapOutOfMemoryException
      Allocates a new free page.
      Parameters:
      tag - Tag to initialize page RW lock.
      Returns:
      Relative pointer to the allocated page.
      Throws:
      GridOffHeapOutOfMemoryException - If failed to allocate new free page.
    • releaseFreePage

      public int releaseFreePage(long relPtr)
      Parameters:
      relPtr - Relative pointer to free.
      Returns:
      Resulting number of pages in pool if pages counter is enabled, 0 otherwise.
    • pages

      public int pages()
      Returns:
      Max number of pages in the pool.
    • size

      public int size()
      Returns:
      Number of pages in the list.
    • getMemoryRegion

      public DirectMemoryRegion getMemoryRegion()
      Returns:
      direct memory region used by the pool
    • estimateNumberOfPages

      public static int estimateNumberOfPages(long memory, int sysPageSize)
      Returns upper bound for total number of pages in pool with the given parameters.
      Parameters:
      memory - total memory in bytes
      sysPageSize - pages size in bytes
      Returns:
      upper bound for total number of pages in pool with the given parameters
    • estimateRequiredMemory

      public static long estimateRequiredMemory(int numPages, int sysPageSize)
      Returns required memory in bytes to accommodate the given number of pages.
      Parameters:
      numPages - number of pages
      sysPageSize - pages size in bytes
      Returns:
      required memory in bytes to accommodate the given number of pages