Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
memory_allocations.h File Reference
#include "typedefs.h"
#include "grassroots_util_library.h"
#include <stdlib.h>
Include dependency graph for memory_allocations.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define InitAllocator()   do {} while (0);
 Initialise the platform memory allocator. More...
 
#define ExitAllocator()   do {} while (0);
 Close the platform memory allocator. More...
 
#define AllocMemory(x)   malloc(x)
 Allocate the memory for, x, the given number of bytes. More...
 
#define AllocMemoryArray(x, y)   calloc(x,y)
 Allocate an array of memory where s is the given number of entries in the array with each entry being y bytes in size. More...
 
#define ReallocMemory(x, y, z)   realloc(x,y)
 Reallocate the memory for the given number of bytes. More...
 
#define FreeMemory(x)   free(x)
 Free the memory pointed to by x. More...
 
#define IsAllocatorThreadSafe()   (1)
 Is the current memory allocator suitable for use in a threaded environment> More...
 

Enumerations

enum  MEM_FLAG { MF_ALREADY_FREED, MF_DEEP_COPY, MF_SHALLOW_COPY, MF_SHADOW_USE }
 An enum specifying the particular status of a piece of dynamically allocated memory for a particular object. More...
 

Functions

struct MappedMemory * AllocateSharedMemory (const char *id_s, size_t size, int flags)
 Allocate some memory that can shared between different processes. More...
 
bool FreeSharedMemory (struct MappedMemory *mapped_memory_p)
 Free the shared memory segment for a given id. More...
 
void * OpenSharedMemory (struct MappedMemory *mapped_memory_p, int flags)
 Open a shared memory segment. More...
 
bool CloseSharedMemory (struct MappedMemory *mapped_memory_p, void *value_p)
 Close a shared memory segment. More...
 

Macro Definition Documentation

◆ InitAllocator

#define InitAllocator ( )    do {} while (0);

Initialise the platform memory allocator.

◆ ExitAllocator

#define ExitAllocator ( )    do {} while (0);

Close the platform memory allocator.

◆ AllocMemory

#define AllocMemory (   x)    malloc(x)

Allocate the memory for, x, the given number of bytes.

◆ AllocMemoryArray

#define AllocMemoryArray (   x,
 
)    calloc(x,y)

Allocate an array of memory where s is the given number of entries in the array with each entry being y bytes in size.

If successful, all entries will be set to zero.

◆ ReallocMemory

#define ReallocMemory (   x,
  y,
 
)    realloc(x,y)

Reallocate the memory for the given number of bytes.

◆ FreeMemory

#define FreeMemory (   x)    free(x)

Free the memory pointed to by x.

◆ IsAllocatorThreadSafe

#define IsAllocatorThreadSafe ( )    (1)

Is the current memory allocator suitable for use in a threaded environment>