Package org.boxutil.manager
Class InstanceDataMemoryPool
java.lang.Object
org.boxutil.manager.InstanceDataMemoryPool
Used for
InstanceRenderAPI.-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanfree(MemoryBlock memory) Even if memory was free, the operation is safe.static intgetBufferID(InstanceType target) static booleanstatic MemoryBlockmalloc(InstanceType target, int count) static booleanrealloc(MemoryBlock memory, int newCount) Bad for performance, so recommend to allocation the large enough memory block before all.static MemoryBlockshare(MemoryBlock memory) static MemoryBlocksplit(MemoryBlock memory, int newCount, boolean fromStartOrEnd)
-
Method Details
-
isNotSupported
public static boolean isNotSupported() -
getBufferID
- Returns:
- the buffer object name of SSBO,
0if never have call malloc with target, or pool was unsupported.Without mutex.
-
malloc
- Parameters:
count- instance data count.- Returns:
nullwhen allocation failed.
-
realloc
Bad for performance, so recommend to allocation the large enough memory block before all.- Parameters:
memory- different from C/C++, will not change the object pointer, only remapping and then copy data if needed.newCount- instance data count.- Returns:
falsewhen re-allocation failed.
-
split
-
free
Even if memory was free, the operation is safe.- Returns:
falsewhen still have reference after call.
-