1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
//------------------------------------------------------------------------------
// GB_memory.h: memory allocation
//------------------------------------------------------------------------------
// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2025, All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//------------------------------------------------------------------------------
#ifndef GB_MEMORY_H
#define GB_MEMORY_H
//------------------------------------------------------------------------------
// memory management
//------------------------------------------------------------------------------
void GB_memoryUsage // count # allocated blocks and their sizes
(
int64_t *nallocs, // # of allocated memory blocks
size_t *mem_deep, // # of bytes in blocks owned by this matrix
size_t *mem_shallow, // # of bytes in blocks owned by another matrix
const GrB_Matrix A, // matrix to query
bool count_hyper_hash // if true, include A->Y
) ;
void *GB_calloc_memory // pointer to allocated block of memory
(
size_t nitems, // number of items to allocate
size_t size_of_item, // sizeof each item
// output
size_t *size_allocated // # of bytes actually allocated
) ;
void *GB_realloc_memory // pointer to reallocated block of memory, or
// to original block if the realloc failed.
(
size_t nitems_new, // new number of items in the object
size_t size_of_item, // sizeof each item
// input/output
void *p, // old object to reallocate
// output
size_t *size_allocated, // # of bytes actually allocated
bool *ok // true if successful, false otherwise
) ;
void *GB_xalloc_memory // return the newly-allocated space
(
// input
bool use_calloc, // if true, use calloc
bool iso, // if true, only allocate a single entry
int64_t n, // # of entries to allocate if non iso
size_t type_size, // size of each entry
// output
size_t *size // resulting size
) ;
//------------------------------------------------------------------------------
// parallel memcpy and memset
//------------------------------------------------------------------------------
void GB_memcpy // parallel memcpy
(
void *dest, // destination
const void *src, // source
size_t n, // # of bytes to copy
int nthreads // # of threads to use
) ;
#endif
|