aclrtAllocatorSetFreeFuncToDesc

Description

Sets the callback function for releasing memory blocks when the user-provided Allocator is used.

Prototype

aclError aclrtAllocatorSetFreeFuncToDesc(aclrtAllocatorDesc allocatorDesc, aclrtAllocatorFreeFunc func)

Parameters

Parameter

Input/Output

Description

allocatorDesc

Input

Pointer to the Allocator descriptor.

Call aclrtAllocatorCreateDesc to set the Allocator description in advance.

func

Input

Callback function for releasing memory blocks.

Callback function definition:

typedef void (*aclrtAllocatorFreeFunc)(aclrtAllocator allocator, aclrtAllocatorBlock block);

aclrtAllocator and aclrtAllocatorBlock definitions:

typedef void *aclrtAllocator;
typedef void *aclrtAllocatorBlock;

Returns

The value 0 indicates success, and other values indicate failure. For details, see aclError.