DefaultHostMemoryAllocator#
- public class DefaultHostMemoryAllocator implements HostMemoryAllocator#
The default
HostMemoryAllocator, which uses pinned memory when requested and available and falls back to off-heap memory.The process-wide default allocator can be changed with
set(HostMemoryAllocator).Method Summary
Allocate memory, but be sure to close the returned buffer to avoid memory leaks.
Allocate memory, but be sure to close the returned buffer to avoid memory leaks.
Retrieve current host memory allocator used by default if not passed directly to API.
Sets a new default host memory allocator implementation by default.
Methods
- public HostMemoryBuffer allocate(long bytes, boolean preferPinned)#
Allocate memory, but be sure to close the returned buffer to avoid memory leaks.
- Parameters:
bytes – size in bytes to allocate
preferPinned – If set to true, the pinned memory pool will be used if possible with a fallback to off-heap memory. If set to false, the allocation will always be from off-heap memory.
- Returns:
the newly created buffer
- public HostMemoryBuffer allocate(long bytes)#
Allocate memory, but be sure to close the returned buffer to avoid memory leaks.
Pinned memory for allocations preference is up to the implementor
- Parameters:
bytes – size in bytes to allocate
- Returns:
the newly created buffer
Static Methods
- public static HostMemoryAllocator get()#
Retrieve current host memory allocator used by default if not passed directly to API.
- Returns:
current default HostMemoryAllocator implementation
- public static void set(HostMemoryAllocator hostMemoryAllocator)#
Sets a new default host memory allocator implementation by default.
- Parameters:
hostMemoryAllocator – the new allocator to use.