Developer Reference for Intel® oneAPI Math Kernel Library for C
mkl_sparse_destroy
Frees memory allocated for matrix handle internals and releases user provided arrays back to the user.
Syntax
sparse_status_t mkl_sparse_destroy ( sparse_matrix_t A );
Include Files
mkl_spblas.h
Description
The mkl_sparse_destroy routine frees memory allocated for matrix handle internals and releases user provided arrays back to the user. The mkl_sparse_destroy routine is the pair routine to the mkl_sparse_?_create_xyz routines (csr, csc,coo, bsr). It should be called after the user is done with the matrix handle, in order to free memory allocated for internal data and release user provided arrays back to the user. After this routine is called, the matrix handle becomes invalid and should not be used in any subsequent calls to other sparse BLAS routines until it is reinitialized by one of the mkl_sparse_?_create_xyz routines.
However, the mkl_sparse_destroy routine does not free memory allocated for user provided data arrays, and it is the user’s responsibility to free memory allocated for user provided data arrays after completing use of them in the sparse matrix handle. If the user does not free memory allocated for user provided data arrays, it may lead to memory leaks in the application. For APIs that create a sparse matrix handle, the library allocates memory for the data arrays, and they are deallocated upon call to mkl_sparse_destroy.
Input Parameters
A
Handle containing internal data to be released.
Output Parameters
A
Handle with released internal data.
User should set the A to NULL after completion of this routine.
Return Values
The function returns a value indicating whether the operation was successful or not, and why.
SPARSE_STATUS_SUCCESS |
The operation was successful. |
SPARSE_STATUS_NOT_INITIALIZED |
The routine encountered an empty handle or matrix array. |
SPARSE_STATUS_ALLOC_FAILED |
Internal memory allocation failed. |
SPARSE_STATUS_INVALID_VALUE |
The input parameters contain an invalid value. |
SPARSE_STATUS_EXECUTION_FAILED |
Execution failed. |
SPARSE_STATUS_INTERNAL_ERROR |
An error in algorithm implementation occurred. |
SPARSE_STATUS_NOT_SUPPORTED |
The requested operation is not supported. |