Class ExtentHooks

  • All Implemented Interfaces:
    java.lang.AutoCloseable, org.lwjgl.system.NativeResource, org.lwjgl.system.Pointer


    public class ExtentHooks
    extends org.lwjgl.system.Struct
    implements org.lwjgl.system.NativeResource
    The extent_hooks_t structure comprises function pointers which are described individually below. jemalloc uses these functions to manage extent lifetime, which starts off with allocation of mapped committed memory, in the simplest case followed by deallocation. However, there are performance and platform reasons to retain extents for later reuse. Cleanup attempts cascade from deallocation to decommit to forced purging to lazy purging, which gives the extent management functions opportunities to reject the most permanent cleanup operations in favor of less permanent (and often less costly) operations. All operations except allocation can be universally opted out of by setting the hook pointers to NULL, or selectively opted out of by returning failure.

    Member documentation

    • alloc – the extent allocation hook
    • dalloc – the extent deallocation hook
    • destroy – the extent destruction hook
    • commit – the extent commit hook
    • decommit – the extent decommit hook
    • purge_lazy – the extent lazy purge hook
    • purge_forced – the extent forced purge hook
    • split – the extent split hook
    • merge – the extent merge hook

    Layout

     struct extent_hooks_t {
         extent_alloc_t alloc;
         extent_dalloc_t dalloc;
         extent_destroy_t destroy;
         extent_commit_t commit;
         extent_decommit_t decommit;
         extent_purge_t purge_lazy;
         extent_purge_t purge_forced;
         extent_split_t split;
         extent_merge_t merge;
     }
    • Field Detail

      • SIZEOF

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

      • ExtentHooks

        public ExtentHooks(java.nio.ByteBuffer container)
        Creates a ExtentHooks 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 Detail

      • sizeof

        public int sizeof()
        Specified by:
        sizeof in class org.lwjgl.system.Struct
      • alloc

        public ExtentAlloc alloc()
        Returns the value of the alloc field.
      • dalloc

        @Nullable
        public ExtentDalloc dalloc()
        Returns the value of the dalloc field.
      • destroy

        @Nullable
        public ExtentDestroy destroy()
        Returns the value of the destroy field.
      • commit

        @Nullable
        public ExtentCommit commit()
        Returns the value of the commit field.
      • decommit

        @Nullable
        public ExtentDecommit decommit()
        Returns the value of the decommit field.
      • purge_lazy

        @Nullable
        public ExtentPurge purge_lazy()
        Returns the value of the purge_lazy field.
      • purge_forced

        @Nullable
        public ExtentPurge purge_forced()
        Returns the value of the purge_forced field.
      • split

        @Nullable
        public ExtentSplit split()
        Returns the value of the split field.
      • merge

        @Nullable
        public ExtentMerge merge()
        Returns the value of the merge field.
      • purge_lazy

        public ExtentHooks purge_lazy(@Nullable
                                      ExtentPurgeI value)
        Sets the specified value to the purge_lazy field.
      • purge_forced

        public ExtentHooks purge_forced(@Nullable
                                        ExtentPurgeI value)
        Sets the specified value to the purge_forced field.
      • set

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

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

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

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

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

        public static ExtentHooks.Buffer malloc(int capacity)
        Returns a new ExtentHooks.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
        Parameters:
        capacity - the buffer capacity
      • calloc

        public static ExtentHooks.Buffer calloc(int capacity)
        Returns a new ExtentHooks.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
        Parameters:
        capacity - the buffer capacity
      • create

        public static ExtentHooks.Buffer create(long address,
                                                int capacity)
        Create a ExtentHooks.Buffer instance at the specified memory.
        Parameters:
        address - the memory address
        capacity - the buffer capacity
      • createSafe

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

        public static ExtentHooks mallocStack()
        Returns a new ExtentHooks instance allocated on the thread-local MemoryStack.
      • callocStack

        public static ExtentHooks callocStack()
        Returns a new ExtentHooks instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
      • mallocStack

        public static ExtentHooks mallocStack(org.lwjgl.system.MemoryStack stack)
        Returns a new ExtentHooks instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
      • callocStack

        public static ExtentHooks callocStack(org.lwjgl.system.MemoryStack stack)
        Returns a new ExtentHooks instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
      • mallocStack

        public static ExtentHooks.Buffer mallocStack(int capacity)
        Returns a new ExtentHooks.Buffer instance allocated on the thread-local MemoryStack.
        Parameters:
        capacity - the buffer capacity
      • callocStack

        public static ExtentHooks.Buffer callocStack(int capacity)
        Returns a new ExtentHooks.Buffer instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
        Parameters:
        capacity - the buffer capacity
      • mallocStack

        public static ExtentHooks.Buffer mallocStack(int capacity,
                                                     org.lwjgl.system.MemoryStack stack)
        Returns a new ExtentHooks.Buffer instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • callocStack

        public static ExtentHooks.Buffer callocStack(int capacity,
                                                     org.lwjgl.system.MemoryStack stack)
        Returns a new ExtentHooks.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • validate

        public static void validate(long struct)
        Validates pointer members that should not be NULL.
        Parameters:
        struct - the struct to validate
      • validate

        public static void validate(long array,
                                    int count)
        Calls ExtentHooks.validate(long) for each struct contained in the specified struct array.
        Parameters:
        array - the struct array to validate
        count - the number of structs in array