Application-implemented class for controlling memory allocation on the GPU/CPU.
More...
#include <NvInferSafeMemAllocator.h>
Application-implemented class for controlling memory allocation on the GPU/CPU.
- Warning
- The lifetime of an ISafeMemAllocator object must exceed that of all objects that use it.
◆ ~ISafeMemAllocator()
| virtual nvinfer2::safe::ISafeMemAllocator::~ISafeMemAllocator |
( |
| ) |
|
|
virtualdefault |
◆ ISafeMemAllocator() [1/3]
| nvinfer2::safe::ISafeMemAllocator::ISafeMemAllocator |
( |
| ) |
|
|
default |
◆ ISafeMemAllocator() [2/3]
◆ ISafeMemAllocator() [3/3]
◆ allocate()
A thread-safe callback implemented by the application to handle acquisition of GPU/CPU memory.
- Precondition
- INIT API
- Parameters
-
- Returns
- If the allocation was successful, the start address of a device memory block of the requested size, nullptr otherwise.
- If an allocation request of size 0 is made, nullptr must be returned.
- If an allocation request cannot be satisfied for any reason, nullptr must be returned.
- If a non-null address is returned, it is guaranteed to have the specified alignment.
- Warning
- The implementation must guarantee thread safety for concurrent allocate/deallocate requests.
- Allowed context for the API call
- Thread-safe: Yes, this method is required to be thread-safe and may be called from multiple threads.
◆ deallocate()
A thread-safe callback implemented by the application to handle release of GPU/CPU memory.
- Precondition
- INIT API
TensorRT may pass a nullptr to this function if it was previously returned by allocate().
- Parameters
-
- Returns
- True if the acquired memory is released successfully, false otherwise.
- Warning
- The implementation must guarantee thread safety for concurrent allocate/deallocate requests.
- Note
- Calling deallocate() multiple times with the same pointer results in undefined behavior. Implementations MUST detect and reject double-free attempts.
- Allowed context for the API call
- Thread-safe: Yes, this method is required to be thread-safe and may be called from multiple threads.
◆ operator=() [1/2]
◆ operator=() [2/2]
The documentation for this class was generated from the following file: