Package com.github.stephengold.joltjni
Class TempAllocatorImpl
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.NonCopyable
com.github.stephengold.joltjni.TempAllocator
com.github.stephengold.joltjni.TempAllocatorImpl
- All Implemented Interfaces:
ConstJoltPhysicsObject
,AutoCloseable
,Comparable<JoltPhysicsObject>
A last-in/first-out implementation of
TempAllocator
.-
Constructor Summary
ConstructorsConstructorDescriptionTempAllocatorImpl
(int numBytes) Instantiate a LIFO allocator with the specified capacity. -
Method Summary
Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
-
Constructor Details
-
TempAllocatorImpl
public TempAllocatorImpl(int numBytes) Instantiate a LIFO allocator with the specified capacity.- Parameters:
numBytes
- the desired capacity (in bytes)
-
-
Method Details
-
getSize
public int getSize()Return the total capacity of the allocator.- Returns:
- the capacity in bytes
-
getUsage
public int getUsage()Return the amount of memory currently allocated.- Returns:
- the number of bytes used (≥0)
-
isEmpty
public boolean isEmpty()Test whether any memory is currently allocated.- Returns:
true
if no memory is allocated, orfalse
if memory is allocated
-