eyBuildLib API Reference : eyBuildLib

ebmem

NAME

ebmem - memory management lib

ROUTINES

ebMemInit( ) - initialize memory management library
ebMalloc( ) - allocate a block of memory from the system memory partition
ebCalloc( ) - allocate space for an array
ebRealloc( ) - reallocate a block of memory
ebFree( ) - free a block of memory
ebStrdup( ) - make a copy of source string
ebMemDestroy( ) - destroy memory management library
ebMemStat( ) - get the statistic info about current management library.
ebMemStatShow( ) - output the memory statistic into stderr

DESCRIPTION

INCLUDE FILES

eblist.h


eyBuildLib : Routines

ebMemInit( )

NAME

ebMemInit( ) - initialize memory management library

SYNOPSIS

int ebMemInit (void)

DESCRIPTION

This routine is to initializes memory management library

RETURNS

OK/ERROR

SEE ALSO

ebmem


eyBuildLib : Routines

ebMalloc( )

NAME

ebMalloc( ) - allocate a block of memory from the system memory partition

SYNOPSIS

void * ebMalloc
    (
    size_t       size,
    const char * file,
    int          line
    )

DESCRIPTION

This routine allocates a block of memory from the free list. The size of the block will be equal to or greater than nBytes.

RETURNS

A pointer to the allocated block of memory, or a null pointer if there is an error.

SEE ALSO

ebmem


eyBuildLib : Routines

ebCalloc( )

NAME

ebCalloc( ) - allocate space for an array

SYNOPSIS

void * ebCalloc
    (
    size_t       num,
    size_t       size,
    const char * file,
    int          line
    )

DESCRIPTION

This routine allocates a block of memory for an array that contains num elements of size size. This space is initialized to zeros.

RETURNS

A pointer to the block, or NULL if the call fails.

SEE ALSO

ebmem


eyBuildLib : Routines

ebRealloc( )

NAME

ebRealloc( ) - reallocate a block of memory

SYNOPSIS

void * ebRealloc
    (
    void *       pbuf,
    size_t       size,
    const char * file,
    int          line
    )

DESCRIPTION

This routine changes the size of a specified block of memory and returns a pointer to the new block of memory. The contents that fit inside the new size (or old size if smaller) remain unchanged. The memory alignment of the new block is not guaranteed to be the same as the original block.

RETURNS

A pointer to the new block of memory, or NULL if the call fails.

SEE ALSO

ebmem


eyBuildLib : Routines

ebFree( )

NAME

ebFree( ) - free a block of memory

SYNOPSIS

void ebFree
    (
    void * pbuf
    )

DESCRIPTION

This routine returns to the free memory pool a block of memory previously allocated with malloc( ) or calloc( ).

RETURNS

N/A

SEE ALSO

ebmem


eyBuildLib : Routines

ebStrdup( )

NAME

ebStrdup( ) - make a copy of source string

SYNOPSIS

char * ebStrdup
    (
    const char * src,
    const char * file,
    int          line
    )

DESCRIPTION

This routine is to allocate a new space and make a copy of source string

RETURNS

pointer to new string, or NULL if allocate failure

SEE ALSO

ebmem


eyBuildLib : Routines

ebMemDestroy( )

NAME

ebMemDestroy( ) - destroy memory management library

SYNOPSIS

void ebMemDestroy (void)

DESCRIPTION

This routine is to destroy memory management library and free the remains memory allocated by ebMalloc( ) or ebCalloc( ).

RETURNS

N/A

SEE ALSO

ebmem


eyBuildLib : Routines

ebMemStat( )

NAME

ebMemStat( ) - get the statistic info about current management library.

SYNOPSIS

int ebMemStat
    (
    MEM_STAT * mstat
    )

DESCRIPTION

This routine is to get the statistic info about current management library

RETURNS

N/A

SEE ALSO

ebmem


eyBuildLib : Routines

ebMemStatShow( )

NAME

ebMemStatShow( ) - output the memory statistic into stderr

SYNOPSIS

int ebMemStatShow
    (
    FILE * fp
    )

DESCRIPTION

This routine is to output the memory statistic into stderr

RETURNS

OK/ERROR

SEE ALSO

ebmem