![]() |
MOS Source Code
|
#include "malloc_wrappers.h"#include <stdint.h>#include <stdio.h>#include <assert.h>#include <string.h>Go to the source code of this file.
Macros | |
| #define | GUARD_SIZE (sizeof(size_t)*3) |
| #define | PREFIX_SIZE (sizeof(size_t)*2) |
| #define | CHECK1 ((size_t)0xDEADBEEF) |
| #define | CHECK2 ((size_t)0x600DCAFE) |
| #define | MAX_ALLOC_BYTES 16*1024*1024 |
| #define | DEBUG_MALLOC 0 |
Functions | |
| static size_t | round_blocksize (size_t size) |
| void * | malloc_with_check (size_t size) |
| void | free_with_check (void *mem) |
| void * | realloc_with_check (void *ptr, size_t size) |
| size_t | get_alloc_count () |
| size_t | get_allocation_size (const void *mem) |
| size_t | get_alloc_bytes () |
| void | set_max_alloc_bytes (size_t max_bytes) |
| size_t | get_max_alloc_bytes () |
Variables | |
| static size_t | g_alloc_count = 0 |
| static size_t | g_alloc_bytes = 0 |
| static size_t | g_max_alloc_bytes = 16*1024*1024 |
| #define GUARD_SIZE (sizeof(size_t)*3) |
Definition at line 12 of file malloc_wrappers.c.
Referenced by malloc_with_check(), and realloc_with_check().
| #define PREFIX_SIZE (sizeof(size_t)*2) |
Definition at line 13 of file malloc_wrappers.c.
Referenced by free_with_check(), get_allocation_size(), malloc_with_check(), and realloc_with_check().
| #define CHECK1 ((size_t)0xDEADBEEF) |
Definition at line 14 of file malloc_wrappers.c.
Referenced by free_with_check(), malloc_with_check(), and realloc_with_check().
| #define CHECK2 ((size_t)0x600DCAFE) |
Definition at line 15 of file malloc_wrappers.c.
Referenced by free_with_check(), malloc_with_check(), and realloc_with_check().
| #define MAX_ALLOC_BYTES 16*1024*1024 |
Definition at line 18 of file malloc_wrappers.c.
| #define DEBUG_MALLOC 0 |
Definition at line 22 of file malloc_wrappers.c.
Referenced by free_with_check(), malloc_with_check(), and realloc_with_check().
Definition at line 47 of file malloc_wrappers.c.
Referenced by malloc_with_check(), and realloc_with_check().
Definition at line 54 of file malloc_wrappers.c.
Referenced by do_callback_decode(), do_decode(), do_roundtrip(), do_stream_decode(), generate_base_message(), main(), rand_protobuf_noise(), realloc_with_check(), and run_iteration().
Definition at line 81 of file malloc_wrappers.c.
Referenced by do_callback_decode(), do_decode(), do_roundtrip(), do_stream_decode(), generate_base_message(), main(), rand_protobuf_noise(), realloc_with_check(), and run_iteration().
| size_t get_alloc_count | ( | ) |
Definition at line 162 of file malloc_wrappers.c.
Referenced by do_callback_decode(), do_decode(), do_roundtrips(), do_stream_decode(), main(), run_iteration(), test_OneofMessage(), and test_TestMessage().
Definition at line 168 of file malloc_wrappers.c.
Referenced by validate_pointer().
| size_t get_alloc_bytes | ( | ) |
Definition at line 175 of file malloc_wrappers.c.
Referenced by do_roundtrips().
Definition at line 181 of file malloc_wrappers.c.
Referenced by do_roundtrips(), and main().
| size_t get_max_alloc_bytes | ( | ) |
Definition at line 186 of file malloc_wrappers.c.
Referenced by do_roundtrips().
|
static |
Definition at line 25 of file malloc_wrappers.c.
Referenced by free_with_check(), get_alloc_count(), malloc_with_check(), and realloc_with_check().
|
static |
Definition at line 26 of file malloc_wrappers.c.
Referenced by free_with_check(), get_alloc_bytes(), malloc_with_check(), and realloc_with_check().
|
static |
Definition at line 27 of file malloc_wrappers.c.
Referenced by get_max_alloc_bytes(), malloc_with_check(), realloc_with_check(), and set_max_alloc_bytes().