public class DefaultHostMemoryAllocator extends Object implements HostMemoryAllocator
构造器和说明 |
---|
DefaultHostMemoryAllocator() |
修饰符和类型 | 方法和说明 |
---|---|
HostMemoryBuffer |
allocate(long bytes)
分配内存,但请务必关闭返回的缓冲区以避免内存泄漏。
|
HostMemoryBuffer |
allocate(long bytes, boolean preferPinned)
分配内存,但请务必关闭返回的缓冲区以避免内存泄漏。
|
static HostMemoryAllocator |
get()
获取默认情况下(如果未直接传递给 API)使用的当前主机内存分配器
|
static void |
set(HostMemoryAllocator hostMemoryAllocator)
默认设置一个新的默认主机内存分配器实现。
|
public static HostMemoryAllocator get()
public static void set(HostMemoryAllocator hostMemoryAllocator)
hostMemoryAllocator
- 要使用的新分配器。public HostMemoryBuffer allocate(long bytes, boolean preferPinned)
HostMemoryAllocator
HostMemoryAllocator
中的 allocate
bytes
- 要分配的大小(字节)preferPinned
- 如果设置为 true,则尽可能使用固定内存池,并回退到堆外内存。如果设置为 false,则始终从堆外内存分配。public HostMemoryBuffer allocate(long bytes)
HostMemoryAllocator
HostMemoryAllocator
中的 allocate
bytes
- 要分配的大小(字节)版权所有 © 2025。保留所有权利。