LibJuno 0.42.0
LibJuno is a lightweight C99 library designed specifically for embedded systems.
Loading...
Searching...
No Matches
memory_api.h File Reference
#include "juno/status.h"
#include "juno/module.h"
#include <stddef.h>
Include dependency graph for memory_api.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  JUNO_MEMORY_BLOCK_METADATA_TAG
 The memory metadata. More...
 
struct  JUNO_MEMORY_TAG
 Structure for an allocated memory segment. Describes the allocated memory with a pointer to the start and its size. More...
 
struct  JUNO_MEMORY_ALLOC_API_TAG
 

Macros

#define JUNO_REF(name)   REF##name
 Define a reference for memory.
 
#define JUNO_NEW_REF(name)   JUNO_MEMORY_T *JUNO_REF(name)
 Create a new reference for memory.
 

Typedefs

typedef struct JUNO_MEMORY_TAG JUNO_MEMORY_T
 
typedef struct JUNO_MEMORY_ALLOC_API_TAG JUNO_MEMORY_ALLOC_API_T
 
typedef union JUNO_MEMORY_ALLOC_TAG JUNO_MEMORY_ALLOC_T
 
typedef struct JUNO_MEMORY_ALLOC_ROOT_TAG JUNO_MEMORY_ALLOC_ROOT_T
 

Functions

struct JUNO_MEMORY_ALLOC_ROOT_TAG JUNO_MODULE_ROOT (JUNO_MEMORY_ALLOC_API_T, JUNO_MODULE_EMPTY)
 
static JUNO_MEMORY_TJuno_MemoryGetRef (JUNO_MEMORY_T *ptMemory)
 
static void Juno_MemoryPutRef (JUNO_MEMORY_T *ptMemory)
 

Macro Definition Documentation

◆ JUNO_NEW_REF

#define JUNO_NEW_REF (   name)    JUNO_MEMORY_T *JUNO_REF(name)

Create a new reference for memory.

◆ JUNO_REF

#define JUNO_REF (   name)    REF##name

Define a reference for memory.

This API has been generated by LibJuno: https://www.robinonsay.com/libjuno/ This header contains the juno_memory library API

Author

Typedef Documentation

◆ JUNO_MEMORY_ALLOC_API_T

◆ JUNO_MEMORY_ALLOC_ROOT_T

typedef struct JUNO_MEMORY_ALLOC_ROOT_TAG JUNO_MEMORY_ALLOC_ROOT_T

◆ JUNO_MEMORY_ALLOC_T

typedef union JUNO_MEMORY_ALLOC_TAG JUNO_MEMORY_ALLOC_T

◆ JUNO_MEMORY_T

Function Documentation

◆ Juno_MemoryGetRef()

static JUNO_MEMORY_T * Juno_MemoryGetRef ( JUNO_MEMORY_T ptMemory)
inlinestatic

Get the reference to this juno memory

  • This function will track the reference count to this memory
  • The reference count is used to prevent freeing of used memory
  • When using JUNO_MEMORY_T it is recommended to pass memory around using this function to increment/decrement the reference count
    Parameters
    ptMemoryThe memory to get the reference to
    Returns
    The reference to the memory

◆ Juno_MemoryPutRef()

static void Juno_MemoryPutRef ( JUNO_MEMORY_T ptMemory)
inlinestatic

Put the reference to this juno memory

  • This function will track the reference count to this memory
  • The reference count is used to prevent freeing of used memory
  • When using JUNO_MEMORY_T it is recommended to pass memory around using this function to increment /decrement the reference count
    Parameters
    ptMemoryThe memory to put the reference away
    Returns
    The reference to the memory

◆ JUNO_MODULE_ROOT()

struct JUNO_MEMORY_ALLOC_ROOT_TAG JUNO_MODULE_ROOT ( JUNO_MEMORY_ALLOC_API_T  ,
JUNO_MODULE_EMPTY   
)