cupy.cuda.PinnedMemoryPool

class cupy.cuda.PinnedMemoryPool(allocator=_malloc)

Memory pool for pinned memory on the host.

Note that it preserves all allocated memory buffers even if the user explicitly release the one. Those released memory buffers are held by the memory pool as free blocks, and reused for further memory allocations of the same size.

Parameters

allocator (function) – The base CuPy pinned memory allocator. It is used for allocating new blocks when the blocks of the required size are all in use.

Methods

free(self, intptr_t ptr, size_t size)
free_all_blocks(self)

Release free all blocks.

malloc(self, size_t size) → PinnedMemoryPointer
n_free_blocks(self)

Count the total number of free blocks.

Returns

The total number of free blocks.

Return type

int