ROOT-Sim core  3.0.0-rc.2
A General-Purpose Multi-threaded Parallel/Distributed Simulation Library
Functions
mm.h File Reference

Memory Manager main header. More...

#include <log/log.h>
#include <arch/mem.h>
#include <core/core.h>
#include <stddef.h>
#include <stdlib.h>
Include dependency graph for mm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static void * mm_aligned_alloc (size_t alignment, size_t mem_size)
 A version of the stdlib aligned_alloc() used internally. More...
 
static void mm_aligned_free (void *ptr)
 A version of the stdlib free() for aligned blocks used internally. More...
 
static void * mm_alloc (size_t mem_size)
 A version of the stdlib malloc() used internally. More...
 
static void * mm_realloc (void *ptr, size_t mem_size)
 A version of the stdlib realloc() used internally. More...
 
static void mm_free (void *ptr)
 A version of the stdlib free() used internally. More...
 

Detailed Description

Memory Manager main header.

Memory Manager main header

Function Documentation

◆ mm_aligned_alloc()

static void* mm_aligned_alloc ( size_t  alignment,
size_t  mem_size 
)
inlinestatic

A version of the stdlib aligned_alloc() used internally.

Parameters
alignmentthe requested alignment value in bytes
mem_sizethe size of the requested memory allocation
Returns
a pointer to the newly allocated memory area

In case of memory allocation failure, a logger message is taken and the simulation is promptly aborted

◆ mm_aligned_free()

static void mm_aligned_free ( void *  ptr)
inlinestatic

A version of the stdlib free() for aligned blocks used internally.

Parameters
ptra pointer to the memory area to free

Needed because Windows has a separate function to handle the release of memory allocated with its non standard _aligned_malloc()

◆ mm_alloc()

static void* mm_alloc ( size_t  mem_size)
inlinestatic

A version of the stdlib malloc() used internally.

Parameters
mem_sizethe size of the requested memory allocation
Returns
a pointer to the newly allocated memory area

In case of memory allocation failure, a logger message is taken and the simulation is promptly aborted

◆ mm_free()

static void mm_free ( void *  ptr)
inlinestatic

A version of the stdlib free() used internally.

Parameters
ptra pointer to the memory area to free

◆ mm_realloc()

static void* mm_realloc ( void *  ptr,
size_t  mem_size 
)
inlinestatic

A version of the stdlib realloc() used internally.

Parameters
ptra pointer to the memory area to reallocate
mem_sizethe new size of the memory allocation
Returns
a pointer to the newly allocated memory area

In case of memory allocation failure, a logger message is taken and the simulation is promptly aborted