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:

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);
}

Created: 2020-10-29 Thu 00:03

Emacs 25.2.2 (Org mode 8.2.10)

Validate