Interfaces for writing custom memory managers.
More...
Interfaces for writing custom memory managers.
Create and set a custom memory manager by first defining the relevant closures for each required function, for example:
void* myPayload = malloc(sizeof(MyPayload_t));
}
void* myPayload;
}
AFAPI af_err af_memory_manager_get_payload(af_memory_manager handle, void **payload)
Gets the payload ptr from an af_memory_manager.
AFAPI af_err af_memory_manager_set_payload(af_memory_manager handle, void *payload)
Sets the payload ptr from an af_memory_manager.
Create an af_memory_manager and attach relevant closures:
AFAPI af_err af_memory_manager_set_initialize_fn(af_memory_manager handle, af_memory_manager_initialize_fn fn)
Sets an af_memory_manager_initialize_fn for a memory manager.
AFAPI af_err af_create_memory_manager(af_memory_manager *out)
Creates an af_memory_manager handle.
AFAPI af_err af_memory_manager_set_allocated_fn(af_memory_manager handle, af_memory_manager_allocated_fn fn)
Sets an af_memory_manager_allocated_fn for a memory manager.
Set the memory manager to be active, which shuts down the existing memory manager:
AFAPI af_err af_set_memory_manager(af_memory_manager handle)
Sets an af_memory_manager to be the default memory manager for non-pinned memory allocations in Array...
Unset to re-create and reset an instance of the default memory manager:
AFAPI af_err af_unset_memory_manager()
Reset the memory manager being used in ArrayFire to the default memory manager, shutting down the exi...