Class RPMallocConfig

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class RPMallocConfig extends Struct<RPMallocConfig> implements NativeResource

 struct rpmalloc_config_t {
     void * (* memory_map) (size_t size, size_t * offset);
     void (* memory_unmap) (void * address, size_t size, size_t offset, int release);
     void (* error_callback) (char const * message);
     int (* map_fail_callback) (size_t size);
     size_t page_size;
     size_t span_size;
     size_t span_map_count;
     int enable_huge_pages;
     char const * page_name;
     char const * huge_page_name;
 }
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • MEMORY_MAP

      public static final int MEMORY_MAP
      The struct member offsets.
    • MEMORY_UNMAP

      public static final int MEMORY_UNMAP
      The struct member offsets.
    • ERROR_CALLBACK

      public static final int ERROR_CALLBACK
      The struct member offsets.
    • MAP_FAIL_CALLBACK

      public static final int MAP_FAIL_CALLBACK
      The struct member offsets.
    • PAGE_SIZE

      public static final int PAGE_SIZE
      The struct member offsets.
    • SPAN_SIZE

      public static final int SPAN_SIZE
      The struct member offsets.
    • SPAN_MAP_COUNT

      public static final int SPAN_MAP_COUNT
      The struct member offsets.
    • ENABLE_HUGE_PAGES

      public static final int ENABLE_HUGE_PAGES
      The struct member offsets.
    • PAGE_NAME

      public static final int PAGE_NAME
      The struct member offsets.
    • HUGE_PAGE_NAME

      public static final int HUGE_PAGE_NAME
      The struct member offsets.
  • Constructor Details

    • RPMallocConfig

      public RPMallocConfig(ByteBuffer container)
      Creates a RPMallocConfig instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

      The created instance holds a strong reference to the container object.

  • Method Details

    • sizeof

      public int sizeof()
      Description copied from class: Struct
      Returns sizeof(struct).
      Specified by:
      sizeof in class Struct<RPMallocConfig>
    • memory_map

      public @Nullable RPMemoryMapCallback memory_map()
      Returns:
      the value of the memory_map field.
    • memory_unmap

      public @Nullable RPMemoryUnmapCallback memory_unmap()
      Returns:
      the value of the memory_unmap field.
    • error_callback

      public @Nullable RPErrorCallback error_callback()
      Returns:
      the value of the error_callback field.
    • map_fail_callback

      public @Nullable RPMapFailCallback map_fail_callback()
      Returns:
      the value of the map_fail_callback field.
    • page_size

      public long page_size()
      Returns:
      the value of the page_size field.
    • span_size

      public long span_size()
      Returns:
      the value of the span_size field.
    • span_map_count

      public long span_map_count()
      Returns:
      the value of the span_map_count field.
    • enable_huge_pages

      public boolean enable_huge_pages()
      Returns:
      the value of the enable_huge_pages field.
    • page_name

      public @Nullable ByteBuffer page_name()
      Returns:
      a ByteBuffer view of the null-terminated string pointed to by the page_name field.
    • page_nameString

      public @Nullable String page_nameString()
      Returns:
      the null-terminated string pointed to by the page_name field.
    • huge_page_name

      public @Nullable ByteBuffer huge_page_name()
      Returns:
      a ByteBuffer view of the null-terminated string pointed to by the huge_page_name field.
    • huge_page_nameString

      public @Nullable String huge_page_nameString()
      Returns:
      the null-terminated string pointed to by the huge_page_name field.
    • memory_map

      public RPMallocConfig memory_map(@Nullable RPMemoryMapCallbackI value)
      Sets the specified value to the memory_map field.
    • memory_unmap

      public RPMallocConfig memory_unmap(@Nullable RPMemoryUnmapCallbackI value)
      Sets the specified value to the memory_unmap field.
    • error_callback

      public RPMallocConfig error_callback(@Nullable RPErrorCallbackI value)
      Sets the specified value to the error_callback field.
    • map_fail_callback

      public RPMallocConfig map_fail_callback(@Nullable RPMapFailCallbackI value)
      Sets the specified value to the map_fail_callback field.
    • page_size

      public RPMallocConfig page_size(long value)
      Sets the specified value to the page_size field.
    • span_size

      public RPMallocConfig span_size(long value)
      Sets the specified value to the span_size field.
    • span_map_count

      public RPMallocConfig span_map_count(long value)
      Sets the specified value to the span_map_count field.
    • enable_huge_pages

      public RPMallocConfig enable_huge_pages(boolean value)
      Sets the specified value to the enable_huge_pages field.
    • page_name

      public RPMallocConfig page_name(@Nullable ByteBuffer value)
      Sets the address of the specified encoded string to the page_name field.
    • huge_page_name

      public RPMallocConfig huge_page_name(@Nullable ByteBuffer value)
      Sets the address of the specified encoded string to the huge_page_name field.
    • set

      public RPMallocConfig set(@Nullable RPMemoryMapCallbackI memory_map, @Nullable RPMemoryUnmapCallbackI memory_unmap, @Nullable RPErrorCallbackI error_callback, @Nullable RPMapFailCallbackI map_fail_callback, long page_size, long span_size, long span_map_count, boolean enable_huge_pages, @Nullable ByteBuffer page_name, @Nullable ByteBuffer huge_page_name)
      Initializes this struct with the specified values.
    • set

      public RPMallocConfig set(RPMallocConfig src)
      Copies the specified struct data to this struct.
      Parameters:
      src - the source struct
      Returns:
      this struct
    • malloc

      public static RPMallocConfig malloc()
      Returns a new RPMallocConfig instance allocated with memAlloc. The instance must be explicitly freed.
    • calloc

      public static RPMallocConfig calloc()
      Returns a new RPMallocConfig instance allocated with memCalloc. The instance must be explicitly freed.
    • create

      public static RPMallocConfig create()
      Returns a new RPMallocConfig instance allocated with BufferUtils.
    • create

      public static RPMallocConfig create(long address)
      Returns a new RPMallocConfig instance for the specified memory address.
    • createSafe

      public static @Nullable RPMallocConfig createSafe(long address)
      Like create, but returns null if address is NULL.
    • mallocStack

      @Deprecated public static RPMallocConfig mallocStack()
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(MemoryStack) instead.
    • callocStack

      @Deprecated public static RPMallocConfig callocStack()
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(MemoryStack) instead.
    • mallocStack

      @Deprecated public static RPMallocConfig mallocStack(MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(MemoryStack) instead.
    • callocStack

      @Deprecated public static RPMallocConfig callocStack(MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(MemoryStack) instead.
    • malloc

      public static RPMallocConfig malloc(MemoryStack stack)
      Returns a new RPMallocConfig instance allocated on the specified MemoryStack.
      Parameters:
      stack - the stack from which to allocate
    • calloc

      public static RPMallocConfig calloc(MemoryStack stack)
      Returns a new RPMallocConfig instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      stack - the stack from which to allocate
    • nmemory_map

      public static @Nullable RPMemoryMapCallback nmemory_map(long struct)
      Unsafe version of memory_map().
    • nmemory_unmap

      public static @Nullable RPMemoryUnmapCallback nmemory_unmap(long struct)
      Unsafe version of memory_unmap().
    • nerror_callback

      public static @Nullable RPErrorCallback nerror_callback(long struct)
      Unsafe version of error_callback().
    • nmap_fail_callback

      public static @Nullable RPMapFailCallback nmap_fail_callback(long struct)
      Unsafe version of map_fail_callback().
    • npage_size

      public static long npage_size(long struct)
      Unsafe version of page_size().
    • nspan_size

      public static long nspan_size(long struct)
      Unsafe version of span_size().
    • nspan_map_count

      public static long nspan_map_count(long struct)
      Unsafe version of span_map_count().
    • nenable_huge_pages

      public static int nenable_huge_pages(long struct)
      Unsafe version of enable_huge_pages().
    • npage_name

      public static @Nullable ByteBuffer npage_name(long struct)
      Unsafe version of page_name().
    • npage_nameString

      public static @Nullable String npage_nameString(long struct)
      Unsafe version of page_nameString().
    • nhuge_page_name

      public static @Nullable ByteBuffer nhuge_page_name(long struct)
      Unsafe version of huge_page_name().
    • nhuge_page_nameString

      public static @Nullable String nhuge_page_nameString(long struct)
      Unsafe version of huge_page_nameString().
    • nmemory_map

      public static void nmemory_map(long struct, @Nullable RPMemoryMapCallbackI value)
      Unsafe version of memory_map.
    • nmemory_unmap

      public static void nmemory_unmap(long struct, @Nullable RPMemoryUnmapCallbackI value)
      Unsafe version of memory_unmap.
    • nerror_callback

      public static void nerror_callback(long struct, @Nullable RPErrorCallbackI value)
      Unsafe version of error_callback.
    • nmap_fail_callback

      public static void nmap_fail_callback(long struct, @Nullable RPMapFailCallbackI value)
      Unsafe version of map_fail_callback.
    • npage_size

      public static void npage_size(long struct, long value)
      Unsafe version of page_size.
    • nspan_size

      public static void nspan_size(long struct, long value)
      Unsafe version of span_size.
    • nspan_map_count

      public static void nspan_map_count(long struct, long value)
      Unsafe version of span_map_count.
    • nenable_huge_pages

      public static void nenable_huge_pages(long struct, int value)
      Unsafe version of enable_huge_pages.
    • npage_name

      public static void npage_name(long struct, @Nullable ByteBuffer value)
      Unsafe version of page_name.
    • nhuge_page_name

      public static void nhuge_page_name(long struct, @Nullable ByteBuffer value)
      Unsafe version of huge_page_name.