Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
mozce_allocator.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define malloc   mozce_malloc
#define free   mozce_free
#define realloc   mozce_realloc
#define calloc   mozce_calloc

Functions

MOZCE_SHUNT_API voidmozce_malloc (unsigned)
MOZCE_SHUNT_API void mozce_free (void *)
MOZCE_SHUNT_API voidmozce_realloc (void *, unsigned)
MOZCE_SHUNT_API voidmozce_calloc (size_t n, size_t size)

Define Documentation

Definition at line 44 of file mozce_allocator.h.

Definition at line 42 of file mozce_allocator.h.

Definition at line 41 of file mozce_allocator.h.

Definition at line 43 of file mozce_allocator.h.


Function Documentation

MOZCE_SHUNT_API void* mozce_calloc ( size_t  n,
size_t  size 
)

Definition at line 356 of file stdlib.cpp.

{
    gTotalMemoryAllocated += n*nelem;
    memoryCheck();

    void* buffer = calloc(n, nelem);
    if (!buffer)
    {
        SHCloseApps(n*nelem);
        buffer = calloc(n, nelem);

        if (!buffer)
            oom();
    }
    return buffer;
}

Here is the call graph for this function:

Definition at line 326 of file stdlib.cpp.

{
    if (!a)
        return;

    gTotalMemoryAllocated -= _msize(a);
    memoryCheck();

    free(a);
}

Here is the call graph for this function:

Definition at line 309 of file stdlib.cpp.

{
    gTotalMemoryAllocated += a;
    memoryCheck();

    void *buffer = malloc(a);
    if (!buffer)
    {
        SHCloseApps(a);
        buffer = malloc(a);

        if (!buffer)
            oom();
    }
    return buffer;
}

Here is the call graph for this function:

MOZCE_SHUNT_API void* mozce_realloc ( void ,
unsigned   
)

Definition at line 337 of file stdlib.cpp.

{
    gTotalMemoryAllocated += b;
    gTotalMemoryAllocated -= _msize(a);
    memoryCheck();
    
    void *buffer = realloc(a,b);
    if (!buffer)
    {
        SHCloseApps(b);
        buffer = realloc(a,b);

        if (!buffer)
            oom();
    }
    return buffer;
}

Here is the call graph for this function: