RainbowBS Manual: dynamic memory management

RainbowBS

RainbowBS Manual  v0.1.0
Written by QWQ([email protected])
dynamic memory management

Macros

#define HDMM_NULL   NULL
 
#define HBLOCK_NULL   NULL
 
#define HMEM_NULL   NULL
 

Typedefs

typedef void * hDMM
 
typedef void * hBLOCK
 
typedef void * hMEM
 

Functions

hDMM RBS_DMM_RegisterBlock (char *pName, void *pDM, USIZE size, USIZE block_size, HMUTEX hMutex)
 Register the memory area as a dynamic block memory area. More...
 
hBLOCK RBS_DMM_AllocZeroBlock (hDMM hDmm)
 Allocate a free block with zero initialization from the dynamic block memory area. More...
 
hBLOCK RBS_DMM_AllocBlock (hDMM hDmm)
 Allocate a free block from the dynamic block memory area. More...
 
BOOL RBS_DMM_FreeBlock (hBLOCK hBlock)
 Free the allocated block. More...
 
void * RBS_DMM_UseHBlock (hBLOCK hBlock)
 Get the allocated block pointer. More...
 
BOOL RBS_DMM_UnuseHBlock (hBLOCK hBlock)
 Unuse the allocated block area. More...
 
hDMM RBS_DMM_RegisterPool (char *pName, void *pDM, USIZE size, BOOL bAntiFrag, U16 handle_count, HMUTEX hMutex)
 Register the memory area as a dynamic pool memory area. More...
 
hMEM RBS_DMM_AllocZeroMem (hDMM hDmm, USIZE size)
 Allocate a free memory with zero initialization from the dynamic memory area. More...
 
hMEM RBS_DMM_AllocMem (hDMM hDmm, USIZE size)
 Allocate a free memory from the dynamic memory area. More...
 
hMEM RBS_DMM_ReallocMem (hMEM hMem, USIZE size)
 Reallocate a free memory from the same dynamic memory area. More...
 
BOOL RBS_DMM_FreeMem (hMEM hMem)
 Free the allocated memory. More...
 
void * RBS_DMM_UseHMem (hMEM hMem)
 Get the allocated memory pointer. More...
 
BOOL RBS_DMM_UnuseHMem (hMEM hMem)
 Unuse the allocated memory area. More...
 
USIZE RBS_DMM_GetHMemSize (hMEM hMem)
 Get the allocated memory size. More...
 

Detailed Description

Dynamic memory management for both memory poll and block.

Function Documentation

hBLOCK RBS_DMM_AllocBlock ( hDMM  hDmm)
Parameters
[in]hDmmhandle of dynamic block memory area.
Return values
HBLOCK_NULLfailed.
othershandle of dynamic memory area.

Here is the call graph for this function:

Here is the caller graph for this function:

hMEM RBS_DMM_AllocMem ( hDMM  hDmm,
USIZE  size 
)
Parameters
[in]hDmmhandle of dynamic memory area.
[in]sizememory area bytes.
Return values
HMEM_NULLfailed.
othershandle of dynamic memory area.

Here is the call graph for this function:

Here is the caller graph for this function:

hBLOCK RBS_DMM_AllocZeroBlock ( hDMM  hDmm)
Parameters
[in]hDmmhandle of dynamic block memory area.
Return values
HBLOCK_NULLfailed.
othershandle of dynamic memory area.

Here is the call graph for this function:

hMEM RBS_DMM_AllocZeroMem ( hDMM  hDmm,
USIZE  size 
)
Parameters
[in]hDmmhandle of dynamic memory area.
[in]sizememory area bytes.
Return values
HMEM_NULLfailed.
othershandle of dynamic memory area.

Here is the call graph for this function:

BOOL RBS_DMM_FreeBlock ( hBLOCK  hBlock)
Parameters
[in]hBlockhandle of a allocated block.
Return values
TRUEsuccessful.
FALSEfailed.

Here is the call graph for this function:

BOOL RBS_DMM_FreeMem ( hMEM  hMem)
Parameters
[in]hMemhandle of a allocated memory.
Return values
TRUEsuccessful.
FALSEfailed.

Here is the call graph for this function:

USIZE RBS_DMM_GetHMemSize ( hMEM  hMem)
Parameters
[in]hMemhandle of the allocated memory.
Returns
memory area size.

Here is the call graph for this function:

hMEM RBS_DMM_ReallocMem ( hMEM  hMem,
USIZE  size 
)
Parameters
[in]hMemhandle of an allocated memory.
[in]sizememory area bytes.
Return values
HMEM_NULLfailed.
othershandle of dynamic memory area.

Here is the call graph for this function:

hDMM RBS_DMM_RegisterBlock ( char *  pName,
void *  pDM,
USIZE  size,
USIZE  block_size,
HMUTEX  hMutex 
)
Parameters
[in]pNameblock memory name.
[in]pDMpointer to the block memory area.
[in]sizeblock memory area size(bytes).
[in]block_sizeeach block size.
[in]hMutexmemory block mutex for thread-safe.If NULL,no thread-safe support.
Return values
HDMM_NULLfailed.
otherhandle of dynamic block memory area.

Here is the call graph for this function:

Here is the caller graph for this function:

hDMM RBS_DMM_RegisterPool ( char *  pName,
void *  pDM,
USIZE  size,
BOOL  bAntiFrag,
U16  handle_count,
HMUTEX  hMutex 
)
Parameters
[in]pNamememory pool name.
[in]pDMpointer to the memory area.
[in]sizememory area size(bytes).
[in]bAntiFragenable defragmentation.
[in]handle_countcount of memory handles.
[in]hMutexmemory pool mutex for thread-safety.If NULL,no thread-safe support.
Return values
NotHDMM_NULL successful.
HDMM_NULLfailed.

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL RBS_DMM_UnuseHBlock ( hBLOCK  hBlock)
Parameters
[in]hBlockhandle of a allocated block.
Returns
block area pointer.
See also
RBS_DMM_UseHBlock()
Note
used in pair with RBS_DMM_UseHBlock()

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL RBS_DMM_UnuseHMem ( hMEM  hMem)
Parameters
[in]hMemhandle of a allocated memory.
Returns
memory area pointer.
See also
RBS_DMM_UseHMem()
Note
used in pair with RBS_DMM_UseHMem()

Here is the call graph for this function:

Here is the caller graph for this function:

void* RBS_DMM_UseHBlock ( hBLOCK  hBlock)
Parameters
[in]hBlockhandle of a allocated block.
Returns
block area pointer.
See also
RBS_DMM_UnuseHBlock()
Note
used in pair with RBS_DMM_UnuseHBlock()

Here is the call graph for this function:

Here is the caller graph for this function:

void* RBS_DMM_UseHMem ( hMEM  hMem)
Parameters
[in]hMemhandle of a allocated memory.
Returns
memory area pointer.
See also
RBS_DMM_UnuseHMem()
Note
used in pair with RBS_DMM_UnuseHMem()

Here is the call graph for this function:

Here is the caller graph for this function:

Generated by   doxygen 1.8.9.1