testOOMlib

testOOMlib —

Synopsis




void*       test_malloc                     (size_t bytes);
void*       test_realloc                    (void *memory,
                                             size_t bytes);
void        test_free                       (void *memory);
char*       test_strdup                     (const char *str);
int         (*TestMemoryFunction)           (void *data);
int         test_oom_handling               (TestMemoryFunction func,
                                             void *data);
int         test_get_malloc_blocks_outstanding
                                            (void);

Description

Details

test_malloc ()

void*       test_malloc                     (size_t bytes);

bytes:

test_realloc ()

void*       test_realloc                    (void *memory,
                                             size_t bytes);

memory:
bytes:

test_free ()

void        test_free                       (void *memory);

memory:

test_strdup ()

char*       test_strdup                     (const char *str);

str:
Returns :

TestMemoryFunction ()

int         (*TestMemoryFunction)           (void *data);

data:
Returns :

test_oom_handling ()

int         test_oom_handling               (TestMemoryFunction func,
                                             void *data);

Tests how well the given function responds to out-of-memory situations. Calls the function repeatedly, failing a different call to malloc() each time. If the function ever returns FALSE, the test fails. The function should return TRUE whenever something valid (such as returning an error, or succeeding) occurs, and FALSE if it gets confused in some way.

func: function to call
data: data to pass to function
Returns :TRUE if the function never returns FALSE

test_get_malloc_blocks_outstanding ()

int         test_get_malloc_blocks_outstanding
                                            (void);

Get the number of outstanding malloc()'d blocks.

Returns :number of blocks