Class CachingNativeMemoryAllocator

java.lang.Object
org.jruby.ext.ffi.jffi.CachingNativeMemoryAllocator

final class CachingNativeMemoryAllocator extends Object
  • Field Details

  • Constructor Details

    • CachingNativeMemoryAllocator

      CachingNativeMemoryAllocator()
  • Method Details

    • bucketIndex

      static int bucketIndex(int size)
    • allocateAligned

      static MemoryIO allocateAligned(Ruby runtime, int size, int align, boolean clear)
      Allocates native memory, aligned to a minimum boundary.
      Parameters:
      runtime - The Ruby runtime
      size - The number of bytes to allocate
      align - The minimum alignment of the memory
      clear - Whether the memory should be cleared (zeroed)
      Returns:
      A new AllocatedDirectMemoryIO
    • align

      private static long align(long offset, long align)
    • roundUpToPowerOf2

      static int roundUpToPowerOf2(int n)
    • clearMemory

      static void clearMemory(long address, int size)