cuda.bindings._v2.driver.mem_pool_trim_to#

cuda.bindings._v2.driver.mem_pool_trim_to(intptr_t pool, size_t min_bytes_to_keep)#

Tries to release memory back to the OS.

Releases memory back to the OS until the pool contains fewer than min_bytes_to_keep reserved bytes, or there is no more memory that the allocator can safely release. The allocator cannot release OS allocations that back outstanding asynchronous allocations. The OS allocations may happen at different granularity from the user allocations.

Parameters:
  • pool (intptr_t) – The memory pool to trim.

  • min_bytes_to_keep (size_t) – If the pool has less than min_bytes_to_keep reserved, the TrimTo operation is a no-op. Otherwise the pool will be guaranteed to have at least min_bytes_to_keep bytes reserved after the operation.

Note

: Allocations that have not been freed count as outstanding.

Note

: Allocations that have been asynchronously freed but whose completion has not been observed on the host (eg. by a synchronize) can count as outstanding.

See also

cuMemPoolTrimTo