Class VulkanHostAllocatorTracker
java.lang.Object
com.io7m.jcoronado.allocation_tracker.VulkanHostAllocatorTracker
- All Implemented Interfaces:
VulkanHostAllocatorCallbacksType.AllocationFunctionType,VulkanHostAllocatorCallbacksType.DeallocationFunctionType,VulkanHostAllocatorCallbacksType.InternalAllocationNotificationType,VulkanHostAllocatorCallbacksType.InternalFreeNotificationType,VulkanHostAllocatorCallbacksType.ReallocationFunctionType,VulkanHostAllocatorType
A delegating allocation tracker that logs and tracks allocations.
-
Constructor Summary
ConstructorsConstructorDescriptionVulkanHostAllocatorTracker(VulkanHostAllocatorType in_delegate) Create an allocator tracker. -
Method Summary
Modifier and TypeMethodDescriptionlongallocate(long size, long alignment, VulkanSystemAllocationScope scope) Allocatesizeoctets of memory, aligned toalignment, of scopescope.longlonglonglonglongvoiddeallocate(long address) Deallocate memory.voidonAllocation(long size, VulkanInternalAllocation type, VulkanSystemAllocationScope scope) Called upon internal allocations.voidonFree(long size, VulkanInternalAllocation type, VulkanSystemAllocationScope scope) Called upon internal deallocations.longreallocate(long address, long size, long alignment, VulkanSystemAllocationScope scope) Reallocatesizeoctets of memory, aligned toalignment, of scopescope.
-
Constructor Details
-
VulkanHostAllocatorTracker
Create an allocator tracker.- Parameters:
in_delegate- The actual allocator
-
-
Method Details
-
allocate
Description copied from interface:VulkanHostAllocatorCallbacksType.AllocationFunctionTypeAllocatesizeoctets of memory, aligned toalignment, of scopescope. The function must return the address of the allocated memory as an integer, or0if the allocation has failed. The function MUST NOT raise exceptions under any circumstances.- Specified by:
allocatein interfaceVulkanHostAllocatorCallbacksType.AllocationFunctionType- Parameters:
size- The size of the allocationalignment- The alignment of the allocationscope- The scope of the allocation- Returns:
- The memory address
-
reallocate
Description copied from interface:VulkanHostAllocatorCallbacksType.ReallocationFunctionTypeReallocatesizeoctets of memory, aligned toalignment, of scopescope. The function must return the address of the allocated memory as an integer, or0if the allocation has failed. The function MUST NOT raise exceptions under any circumstances.- Specified by:
reallocatein interfaceVulkanHostAllocatorCallbacksType.ReallocationFunctionType- Parameters:
address- The original memory addresssize- The size of the allocationalignment- The alignment of the allocationscope- The scope of the allocation- Returns:
- The memory address
-
deallocate
public void deallocate(long address) Description copied from interface:VulkanHostAllocatorCallbacksType.DeallocationFunctionTypeDeallocate memory. The function MUST NOT raise exceptions under any circumstances.- Specified by:
deallocatein interfaceVulkanHostAllocatorCallbacksType.DeallocationFunctionType- Parameters:
address- The original memory address
-
onAllocation
public void onAllocation(long size, VulkanInternalAllocation type, VulkanSystemAllocationScope scope) Description copied from interface:VulkanHostAllocatorCallbacksType.InternalAllocationNotificationTypeCalled upon internal allocations. The function MUST NOT raise exceptions under any circumstances.- Specified by:
onAllocationin interfaceVulkanHostAllocatorCallbacksType.InternalAllocationNotificationType- Parameters:
size- The allocation size in bytestype- The type of allocationscope- The scope of the allocation
-
onFree
Description copied from interface:VulkanHostAllocatorCallbacksType.InternalFreeNotificationTypeCalled upon internal deallocations. The function MUST NOT raise exceptions under any circumstances.- Specified by:
onFreein interfaceVulkanHostAllocatorCallbacksType.InternalFreeNotificationType- Parameters:
size- The allocation size in bytestype- The type of allocationscope- The scope of the allocation
-
createCallbacks
- Specified by:
createCallbacksin interfaceVulkanHostAllocatorType- 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
-