# Class VulkanHostAllocatorTracker

java.lang.Object
com.io7m.jcoronado.utility.allocation_tracker.VulkanHostAllocatorTracker

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

public final class VulkanHostAllocatorTracker extends Object implements VulkanHostAllocatorType
A delegating allocation tracker that logs and tracks allocations.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VulkanHostAllocatorTracker(VulkanHostAllocatorType in_delegate)`
  Create an allocator tracker.

- ## 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`.
  `long`
  `allocatedCacheScopeOctets()`
  `long`
  `allocatedCommandScopeOctets()`
  `long`
  `allocatedDeviceScopeOctets()`
  `long`
  `allocatedInstanceScopeOctets()`
  `long`
  `allocatedObjectScopeOctets()`
  `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 Object

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

- ## Constructor Details

  - ### VulkanHostAllocatorTracker

    public VulkanHostAllocatorTracker(VulkanHostAllocatorType in_delegate)
    Create an allocator tracker.
    Parameters:
      `in_delegate` - The actual 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

  - ### allocatedCommandScopeOctets

    public long allocatedCommandScopeOctets()
    Returns:
      The number of octets allocated at command scope

  - ### allocatedCacheScopeOctets

    public long allocatedCacheScopeOctets()
    Returns:
      The number of octets allocated at cache scope

  - ### allocatedDeviceScopeOctets

    public long allocatedDeviceScopeOctets()
    Returns:
      The number of octets allocated at device scope

  - ### allocatedInstanceScopeOctets

    public long allocatedInstanceScopeOctets()
    Returns:
      The number of octets allocated at instance scope

  - ### allocatedObjectScopeOctets

    public long allocatedObjectScopeOctets()
    Returns:
      The number of octets allocated at object scope