//------------------------------------------------------------------------------ // GxB_Matrix_memoryUsage: # of bytes used for a matrix //------------------------------------------------------------------------------ // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023, All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 //------------------------------------------------------------------------------ #include "GB.h" GrB_Info GxB_Matrix_memoryUsage // return # of bytes used for a matrix ( size_t *size, // # of bytes used by the matrix A const GrB_Matrix A // matrix to query ) { //-------------------------------------------------------------------------- // check inputs //-------------------------------------------------------------------------- GB_WHERE1 ("GxB_Matrix_memoryUsage (&size, A)") ; GB_RETURN_IF_NULL (size) ; GB_RETURN_IF_NULL_OR_FAULTY (A) ; //-------------------------------------------------------------------------- // get the memory size taken by the matrix //-------------------------------------------------------------------------- int64_t nallocs ; size_t mem_shallow ; GB_memoryUsage (&nallocs, size, &mem_shallow, A, true) ; return (GrB_SUCCESS) ; }