Class DefaultBufferAllocators


  • public final class DefaultBufferAllocators
    extends Object
    Accessor for the default, shared BufferAllocator instances. Two allocators are provided; one on-heap allocator, and one off-heap allocator.

    These default allocators are configured via system properties.

    These allocators cannot be closed directly. They will instead be disposed of when the Runtime is shutdown.

    • Method Detail

      • preferredAllocator

        public static BufferAllocator preferredAllocator()
        Get the preferred, shared allocator. This allocator is either on- or off-heap, and either pooling or unpooled, depending on the global configuration.
        Returns:
        The shared, generally preferred allocator.
      • onHeapAllocator

        public static BufferAllocator onHeapAllocator()
        Get the shared on-heap allocator. This allocator always allocates on-heap buffers, and is either pooled, or unpooled.
        Returns:
        The shared on-heap allocator.
      • offHeapAllocator

        public static BufferAllocator offHeapAllocator()
        Get the shared off-heap allocator. This allocator always allocates off-heap buffers, and is either pooled, or unpooled.
        Returns:
        The shared off-heap allocator.