(git:374b731)
Loading...
Searching...
No Matches
dbm_mempool.c File Reference
#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.
 
static void actual_free (void *memory, const bool on_device)
 Private routine for actually freeing system memory.
 
static void * internal_mempool_malloc (const size_t size, const bool on_device)
 Private routine for allocating host or device memory from the pool.
 
void * dbm_mempool_host_malloc (const size_t size)
 Internal routine for allocating host memory from the pool.
 
void * dbm_mempool_device_malloc (const size_t size)
 Internal routine for allocating device memory from the pool.
 
void dbm_mempool_free (void *mem)
 Internal routine for releasing memory back to the pool.
 
void dbm_mempool_clear (void)
 Internal routine for freeing all memory in the pool.
 

Variables

static dbm_memchunk_tmempool_available_head = NULL
 Private linked list of memory chunks that are available.
 
static dbm_memchunk_tmempool_allocated_head = NULL
 Private linked list of memory chunks that are in use.
 

Typedef Documentation

◆ dbm_memchunk_t

typedef struct dbm_memchunk dbm_memchunk_t

Definition at line 74 of file dbm_mempool.c.

Function Documentation

◆ actual_malloc()

static void * actual_malloc ( const size_t  size,
const bool  on_device 
)
static

Private routine for actually allocating system memory.

Author
Ole Schuett

Definition at line 22 of file dbm_mempool.c.

Here is the caller graph for this function:

◆ actual_free()

static void actual_free ( void *  memory,
const bool  on_device 
)
static

Private routine for actually freeing system memory.

Author
Ole Schuett

Definition at line 46 of file dbm_mempool.c.

Here is the caller graph for this function:

◆ internal_mempool_malloc()

static void * internal_mempool_malloc ( const size_t  size,
const bool  on_device 
)
static

Private routine for allocating host or device memory from the pool.

Author
Ole Schuett

Definition at line 92 of file dbm_mempool.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dbm_mempool_host_malloc()

void * dbm_mempool_host_malloc ( const size_t  size)

Internal routine for allocating host memory from the pool.

Author
Ole Schuett

Definition at line 141 of file dbm_mempool.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dbm_mempool_device_malloc()

void * dbm_mempool_device_malloc ( const size_t  size)

Internal routine for allocating device memory from the pool.

Author
Ole Schuett

Definition at line 149 of file dbm_mempool.c.

Here is the call graph for this function:

◆ dbm_mempool_free()

void dbm_mempool_free ( void *  mem)

Internal routine for releasing memory back to the pool.

Author
Ole Schuett

Definition at line 157 of file dbm_mempool.c.

Here is the caller graph for this function:

◆ dbm_mempool_clear()

void dbm_mempool_clear ( void  )

Internal routine for freeing all memory in the pool.

Author
Ole Schuett

Definition at line 185 of file dbm_mempool.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ mempool_available_head

dbm_memchunk_t* mempool_available_head = NULL
static

Private linked list of memory chunks that are available.

Author
Ole Schuett

Definition at line 80 of file dbm_mempool.c.

◆ mempool_allocated_head

dbm_memchunk_t* mempool_allocated_head = NULL
static

Private linked list of memory chunks that are in use.

Author
Ole Schuett

Definition at line 86 of file dbm_mempool.c.