Memory management
Table of Contents
We override the allocation functions to enable the possibility of optimized libraries to fine-tune the memory allocation.
3 files are produced:
- a header file :
qmckl_memory.h
- a source file :
qmckl_memory.c
- a test file :
test_qmckl_memory.c
1 qmckl_malloc
Analogous of malloc, but passing a context and a signed 64-bit integers as argument.
1.1 Header
void* qmckl_malloc(const qmckl_context ctx, const size_t size);
1.2 Source
void* qmckl_malloc(const qmckl_context ctx, const size_t size) { if (ctx == (qmckl_context) 0) { /* Avoids unused parameter error */ return malloc( (size_t) size ); } return malloc( (size_t) size ); }
2 qmckl_free
2.1 Header
void qmckl_free(void *ptr);
2.2 Source
void qmckl_free(void *ptr) { free(ptr); }