SDL
2.0
|
#include "SDL_config.h"
#include "SDL_assert.h"
#include "SDL_stdinc.h"
#include "SDL_log.h"
#include "SDL_test_crc32.h"
#include "SDL_test_memory.h"
Go to the source code of this file.
Data Structures | |
struct | SDL_tracked_allocation |
Macros | |
#define | ADD_LINE() |
Functions | |
static unsigned int | get_allocation_bucket (void *mem) |
static SDL_bool | SDL_IsAllocationTracked (void *mem) |
static void | SDL_TrackAllocation (void *mem, size_t size) |
static void | SDL_UntrackAllocation (void *mem) |
static void * | SDLTest_TrackedMalloc (size_t size) |
static void * | SDLTest_TrackedCalloc (size_t nmemb, size_t size) |
static void * | SDLTest_TrackedRealloc (void *ptr, size_t size) |
static void | SDLTest_TrackedFree (void *ptr) |
int | SDLTest_TrackAllocations () |
Start tracking SDL memory allocations. More... | |
void | SDLTest_LogAllocations () |
Print a log of any outstanding allocations. More... | |
Variables | |
static SDLTest_Crc32Context | s_crc32_context |
static SDL_malloc_func | SDL_malloc_orig = NULL |
static SDL_calloc_func | SDL_calloc_orig = NULL |
static SDL_realloc_func | SDL_realloc_orig = NULL |
static SDL_free_func | SDL_free_orig = NULL |
static int | s_previous_allocations = 0 |
static SDL_tracked_allocation * | s_tracked_allocations [256] |
#define ADD_LINE | ( | ) |
Referenced by SDLTest_LogAllocations().
|
static |
Definition at line 56 of file SDL_test_memory.c.
References CrcUint32, CrcUint8, SDL_arraysize, and SDLTest_Crc32Calc().
Referenced by SDL_IsAllocationTracked(), SDL_TrackAllocation(), and SDL_UntrackAllocation().
Definition at line 65 of file SDL_test_memory.c.
References get_allocation_bucket(), SDL_tracked_allocation::mem, SDL_tracked_allocation::next, SDL_FALSE, and SDL_TRUE.
Referenced by SDL_TrackAllocation(), SDLTest_TrackedFree(), and SDLTest_TrackedRealloc().
Definition at line 77 of file SDL_test_memory.c.
References context, cursor, get_allocation_bucket(), SDL_tracked_allocation::mem, SDL_tracked_allocation::next, SDL_arraysize, SDL_IsAllocationTracked(), SDL_malloc_orig, SDL_zero, SDL_tracked_allocation::size, SDL_tracked_allocation::stack, and SDL_tracked_allocation::stack_names.
Referenced by SDLTest_TrackedCalloc(), SDLTest_TrackedMalloc(), and SDLTest_TrackedRealloc().
Definition at line 127 of file SDL_test_memory.c.
References get_allocation_bucket(), SDL_tracked_allocation::mem, SDL_tracked_allocation::next, NULL, and SDL_free_orig.
Referenced by SDLTest_TrackedFree(), and SDLTest_TrackedRealloc().
void SDLTest_LogAllocations | ( | ) |
Print a log of any outstanding allocations.
Definition at line 222 of file SDL_test_memory.c.
References ADD_LINE, SDL_tracked_allocation::next, NULL, SDL_arraysize, SDL_Log, SDL_malloc_orig, SDL_PRIx64, SDL_snprintf, SDL_strlcpy, SDL_tracked_allocation::size, SDL_tracked_allocation::stack, and SDL_tracked_allocation::stack_names.
Referenced by SDLTest_CommonQuit().
int SDLTest_TrackAllocations | ( | ) |
Start tracking SDL memory allocations.
Definition at line 197 of file SDL_test_memory.c.
References s_previous_allocations, SDL_calloc_orig, SDL_free_orig, SDL_GetMemoryFunctions, SDL_GetNumAllocations, SDL_Log, SDL_malloc_orig, SDL_realloc_orig, SDL_SetMemoryFunctions, SDLTest_Crc32Init(), SDLTest_TrackedCalloc(), SDLTest_TrackedFree(), SDLTest_TrackedMalloc(), and SDLTest_TrackedRealloc().
Referenced by SDLTest_CommonCreateState().
Definition at line 158 of file SDL_test_memory.c.
References SDL_tracked_allocation::mem, SDL_calloc_orig, and SDL_TrackAllocation().
Referenced by SDLTest_TrackAllocations().
Definition at line 184 of file SDL_test_memory.c.
References s_previous_allocations, SDL_assert, SDL_free_orig, SDL_IsAllocationTracked(), and SDL_UntrackAllocation().
Referenced by SDLTest_TrackAllocations().
Definition at line 147 of file SDL_test_memory.c.
References SDL_tracked_allocation::mem, SDL_malloc_orig, and SDL_TrackAllocation().
Referenced by SDLTest_TrackAllocations().
Definition at line 169 of file SDL_test_memory.c.
References SDL_tracked_allocation::mem, SDL_assert, SDL_IsAllocationTracked(), SDL_realloc_orig, SDL_TrackAllocation(), and SDL_UntrackAllocation().
Referenced by SDLTest_TrackAllocations().
|
static |
Definition at line 48 of file SDL_test_memory.c.
|
static |
Definition at line 53 of file SDL_test_memory.c.
Referenced by SDLTest_TrackAllocations(), and SDLTest_TrackedFree().
|
static |
Definition at line 54 of file SDL_test_memory.c.
|
static |
Definition at line 50 of file SDL_test_memory.c.
Referenced by SDLTest_TrackAllocations(), and SDLTest_TrackedCalloc().
|
static |
Definition at line 52 of file SDL_test_memory.c.
Referenced by SDL_UntrackAllocation(), SDLTest_TrackAllocations(), and SDLTest_TrackedFree().
|
static |
Definition at line 49 of file SDL_test_memory.c.
Referenced by SDL_TrackAllocation(), SDLTest_LogAllocations(), SDLTest_TrackAllocations(), and SDLTest_TrackedMalloc().
|
static |
Definition at line 51 of file SDL_test_memory.c.
Referenced by SDLTest_TrackAllocations(), and SDLTest_TrackedRealloc().