aclrtMemPoolTrimTo

Note: This API is reserved and is not supported currently.

Function

Trims the memory pool and retains the memory of a specified size.

When the aclrtMemPoolFreeAsync API is called to free memory, the memory is only returned to the memory pool and not physically freed. As a result, the memory may be continuously occupied, and the aclrtMemPoolMallocAsync API cannot allocate new memory. In this case, you can call the aclrtMemPoolTrimTo API to trim the memory pool and free the unused physical memory without affecting the physical memory that is currently in use.

Prototype

1
aclError aclrtMemPoolTrimTo(aclrtMemPool memPool, size_t minBytesToKeep)

Parameters

Parameter

Input/Output

Description

memPool

Input

Memory pool instance. For details about the type definition, see aclrtMemPool.

minBytesToKeep

Input

Size of the physical memory to be reserved in the memory pool after the memory pool is trimmed, in bytes.

Returns

0 on success; otherwise, failure. For details, see aclError.