(git:3add494)
|
#include <assert.h>
#include <omp.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include "../offload/offload_library.h"
#include "../offload/offload_runtime.h"
#include "dbm_mempool.h"
Go to the source code of this file.
Data Structures | |
struct | dbm_memchunk |
Private struct for storing a chunk of memory. More... | |
Typedefs | |
typedef struct dbm_memchunk | dbm_memchunk_t |
Functions | |
static void * | actual_malloc (const size_t size, const bool on_device) |
Private routine for actually allocating system memory. More... | |
static void | actual_free (void *memory, const bool on_device) |
Private routine for actually freeing system memory. More... | |
static void * | internal_mempool_malloc (const size_t size, const bool on_device) |
Private routine for allocating host or device memory from the pool. More... | |
void * | dbm_mempool_host_malloc (const size_t size) |
Internal routine for allocating host memory from the pool. More... | |
void * | dbm_mempool_device_malloc (const size_t size) |
Internal routine for allocating device memory from the pool. More... | |
void | dbm_mempool_free (void *mem) |
Internal routine for releasing memory back to the pool. More... | |
void | dbm_mempool_clear (void) |
Internal routine for freeing all memory in the pool. More... | |
Variables | |
static dbm_memchunk_t * | mempool_available_head = NULL |
Private linked list of memory chunks that are available. More... | |
static dbm_memchunk_t * | mempool_allocated_head = NULL |
Private linked list of memory chunks that are in use. More... | |
typedef struct dbm_memchunk dbm_memchunk_t |
Definition at line 46 of file dbm_mempool.c.
|
static |
Private routine for actually allocating system memory.
Definition at line 22 of file dbm_mempool.c.
|
static |
Private routine for actually freeing system memory.
Definition at line 46 of file dbm_mempool.c.
|
static |
Private routine for allocating host or device memory from the pool.
Definition at line 92 of file dbm_mempool.c.
void* dbm_mempool_host_malloc | ( | const size_t | size | ) |
Internal routine for allocating host memory from the pool.
Definition at line 141 of file dbm_mempool.c.
void* dbm_mempool_device_malloc | ( | const size_t | size | ) |
Internal routine for allocating device memory from the pool.
Definition at line 149 of file dbm_mempool.c.
void dbm_mempool_free | ( | void * | mem | ) |
Internal routine for releasing memory back to the pool.
Definition at line 157 of file dbm_mempool.c.
void dbm_mempool_clear | ( | void | ) |
Internal routine for freeing all memory in the pool.
Definition at line 185 of file dbm_mempool.c.
|
static |
Private linked list of memory chunks that are available.
Definition at line 80 of file dbm_mempool.c.
|
static |
Private linked list of memory chunks that are in use.
Definition at line 86 of file dbm_mempool.c.