SimGrid  3.18
Versatile Simulation of Distributed Systems
mm_module.c File Reference
#include "src/internal_config.h"
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <string.h>
#include "mmprivate.h"
#include "xbt/ex.h"
#include "src/xbt_modinter.h"

Macros

#define SEEK_SET   0
 
#define HEAP_OFFSET   (128UL<<20)
 

Functions

xbt_mheap_t xbt_mheap_new (int fd, void *baseaddr)
 
xbt_mheap_t xbt_mheap_new_options (int fd, void *baseaddr, int options)
 
void xbt_mheap_destroy_no_free (xbt_mheap_t md)
 Terminate access to a mmalloc managed region, but do not free its content. More...
 
voidxbt_mheap_destroy (xbt_mheap_t mdp)
 Terminate access to a mmalloc managed region by unmapping all memory pages associated with the region, and closing the file descriptor if it is one that we opened. More...
 
xbt_mheap_t mmalloc_get_default_md (void)
 
static void mmalloc_fork_prepare (void)
 
static void mmalloc_fork_parent (void)
 
static void mmalloc_fork_child (void)
 
voidmmalloc_preinit (void)
 
void mmalloc_postexit (void)
 
size_t mmalloc_get_bytes_used_remote (size_t heaplimit, const malloc_info *heapinfo)
 
size_t mmalloc_get_bytes_used (const xbt_mheap_t heap)
 
ssize_t mmalloc_get_busy_size (xbt_mheap_t heap, void *ptr)
 

Macro Definition Documentation

◆ SEEK_SET

#define SEEK_SET   0

◆ HEAP_OFFSET

#define HEAP_OFFSET   (128UL<<20)

Function Documentation

◆ xbt_mheap_new()

xbt_mheap_t xbt_mheap_new ( int  fd,
void baseaddr 
)

◆ xbt_mheap_new_options()

xbt_mheap_t xbt_mheap_new_options ( int  fd,
void baseaddr,
int  options 
)

◆ xbt_mheap_destroy_no_free()

void xbt_mheap_destroy_no_free ( xbt_mheap_t  md)

Terminate access to a mmalloc managed region, but do not free its content.

This is for example useful for the base region where ldl stores its data because it leaves the place after us.

◆ xbt_mheap_destroy()

void* xbt_mheap_destroy ( xbt_mheap_t  mdp)

Terminate access to a mmalloc managed region by unmapping all memory pages associated with the region, and closing the file descriptor if it is one that we opened.

Returns NULL on success.

Returns the malloc descriptor on failure, which can subsequently be used for further action, such as obtaining more information about the nature of the failure.

Note that the malloc descriptor that we are using is currently located in region we are about to unmap, so we first make a local copy of it on the stack and use the copy.

◆ mmalloc_get_default_md()

xbt_mheap_t mmalloc_get_default_md ( void  )

◆ mmalloc_fork_prepare()

static void mmalloc_fork_prepare ( void  )
static

◆ mmalloc_fork_parent()

static void mmalloc_fork_parent ( void  )
static

◆ mmalloc_fork_child()

static void mmalloc_fork_child ( void  )
static

◆ mmalloc_preinit()

void* mmalloc_preinit ( void  )

◆ mmalloc_postexit()

void mmalloc_postexit ( void  )

◆ mmalloc_get_bytes_used_remote()

size_t mmalloc_get_bytes_used_remote ( size_t  heaplimit,
const malloc_info heapinfo 
)

◆ mmalloc_get_bytes_used()

size_t mmalloc_get_bytes_used ( const xbt_mheap_t  heap)

◆ mmalloc_get_busy_size()

ssize_t mmalloc_get_busy_size ( xbt_mheap_t  heap,
void ptr 
)