# Class VulkanLWJGLHostAllocatorJeMalloc

java.lang.Object
com.io7m.jcoronado.lwjgl.VulkanLWJGLHostAllocatorJeMalloc

All Implemented Interfaces:
  `VulkanHostAllocatorCallbacksType.AllocationFunctionType`, `VulkanHostAllocatorCallbacksType.DeallocationFunctionType`, `VulkanHostAllocatorCallbacksType.InternalAllocationNotificationType`, `VulkanHostAllocatorCallbacksType.InternalFreeNotificationType`, `VulkanHostAllocatorCallbacksType.ReallocationFunctionType`, `VulkanHostAllocatorType`

public final class VulkanLWJGLHostAllocatorJeMalloc extends Object implements VulkanHostAllocatorType
A JeMalloc based host allocator.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VulkanLWJGLHostAllocatorJeMalloc()`
  Construct an allocator.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `long`
  `allocate(long size, long alignment, VulkanSystemAllocationScope scope)`
  Allocate `size` octets of memory, aligned to `alignment`, of scope `scope`.
  `VulkanHostAllocatorCallbacks`
  `createCallbacks()`
  `void`
  `deallocate(long address)`
  Deallocate memory.
  `void`
  `onAllocation(long size, VulkanInternalAllocation type, VulkanSystemAllocationScope scope)`
  Called upon internal allocations.
  `void`
  `onFree(long size, VulkanInternalAllocation type, VulkanSystemAllocationScope scope)`
  Called upon internal deallocations.
  `long`
  `reallocate(long address, long size, long alignment, VulkanSystemAllocationScope scope)`
  Reallocate `size` octets of memory, aligned to `alignment`, of scope `scope`.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### VulkanLWJGLHostAllocatorJeMalloc

    public VulkanLWJGLHostAllocatorJeMalloc()
    Construct an allocator.

- ## Method Details

  - ### allocate

    public long allocate(long size, long alignment, VulkanSystemAllocationScope scope)
    Description copied from interface: `VulkanHostAllocatorCallbacksType.AllocationFunctionType`
    Allocate `size` octets of memory, aligned to `alignment`, of scope `scope`. The function must return the address of the allocated memory as an integer, or `0` if the allocation has failed. The function MUST NOT raise exceptions under any circumstances.
    Specified by:
      `allocate` in interface `VulkanHostAllocatorCallbacksType.AllocationFunctionType`
    Parameters:
      `size` - The size of the allocation
      `alignment` - The alignment of the allocation
      `scope` - The scope of the allocation
    Returns:
      The memory address

  - ### reallocate

    public long reallocate(long address, long size, long alignment, VulkanSystemAllocationScope scope)
    Description copied from interface: `VulkanHostAllocatorCallbacksType.ReallocationFunctionType`
    Reallocate `size` octets of memory, aligned to `alignment`, of scope `scope`. The function must return the address of the allocated memory as an integer, or `0` if the allocation has failed. The function MUST NOT raise exceptions under any circumstances.
    Specified by:
      `reallocate` in interface `VulkanHostAllocatorCallbacksType.ReallocationFunctionType`
    Parameters:
      `address` - The original memory address
      `size` - The size of the allocation
      `alignment` - The alignment of the allocation
      `scope` - The scope of the allocation
    Returns:
      The memory address

  - ### deallocate

    public void deallocate(long address)
    Description copied from interface: `VulkanHostAllocatorCallbacksType.DeallocationFunctionType`
    Deallocate memory. The function MUST NOT raise exceptions under any circumstances.
    Specified by:
      `deallocate` in interface `VulkanHostAllocatorCallbacksType.DeallocationFunctionType`
    Parameters:
      `address` - The original memory address

  - ### onAllocation

    public void onAllocation(long size, VulkanInternalAllocation type, VulkanSystemAllocationScope scope)
    Description copied from interface: `VulkanHostAllocatorCallbacksType.InternalAllocationNotificationType`
    Called upon internal allocations. The function MUST NOT raise exceptions under any circumstances.
    Specified by:
      `onAllocation` in interface `VulkanHostAllocatorCallbacksType.InternalAllocationNotificationType`
    Parameters:
      `size` - The allocation size in bytes
      `type` - The type of allocation
      `scope` - The scope of the allocation

  - ### onFree

    public void onFree(long size, VulkanInternalAllocation type, VulkanSystemAllocationScope scope)
    Description copied from interface: `VulkanHostAllocatorCallbacksType.InternalFreeNotificationType`
    Called upon internal deallocations. The function MUST NOT raise exceptions under any circumstances.
    Specified by:
      `onFree` in interface `VulkanHostAllocatorCallbacksType.InternalFreeNotificationType`
    Parameters:
      `size` - The allocation size in bytes
      `type` - The type of allocation
      `scope` - The scope of the allocation

  - ### createCallbacks

    public VulkanHostAllocatorCallbacks createCallbacks()
    Specified by:
      `createCallbacks` in interface `VulkanHostAllocatorType`
    Returns:
      The methods as a set of callbacks