21#include "SDL_config.h"
28#ifdef HAVE_LIBUNWIND_H
94#ifdef HAVE_LIBUNWIND_H
104 while (unw_step(&
cursor) > 0) {
108 unw_get_reg(&
cursor, UNW_REG_IP, &pc);
109 entry->
stack[stack_index] = pc;
111 if (unw_get_proc_name(&
cursor, sym,
sizeof(sym), &
offset) == 0) {
225 size_t message_size = 0;
226 char line[128], *tmp;
236 message_size += (SDL_strlen(line) + 1); \
237 tmp = (char *)SDL_realloc_orig(message, message_size); \
242 SDL_strlcat(message, line, message_size)
244 SDL_strlcpy(line,
"Memory allocations:\n",
sizeof(line));
246 SDL_strlcpy(line,
"Expect 2 allocations from within SDL_GetErrBuf()\n",
sizeof(line));
257 if (!entry->
stack[stack_index]) {
263 total_allocated += entry->
size;
267 SDL_snprintf(line,
sizeof(line),
"Total: %.2f Kb in %d allocations\n", (
float)total_allocated / 1024,
count);
#define SDL_assert(condition)
#define SDL_GetNumAllocations
#define SDL_GetMemoryFunctions
#define SDL_SetMemoryFunctions
GLuint GLuint GLsizei count
GLuint GLsizei const GLchar * message
void *(* SDL_malloc_func)(size_t size)
void(* SDL_free_func)(void *mem)
#define SDL_arraysize(array)
void *(* SDL_calloc_func)(size_t nmemb, size_t size)
void *(* SDL_realloc_func)(void *mem, size_t size)
int SDLTest_Crc32Calc(SDLTest_Crc32Context *crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32)
calculate a crc32 from a data block
int SDLTest_Crc32Init(SDLTest_Crc32Context *crcContext)
Initialize the CRC context.
static void SDL_TrackAllocation(void *mem, size_t size)
static SDLTest_Crc32Context s_crc32_context
static int s_previous_allocations
static SDL_calloc_func SDL_calloc_orig
static void SDLTest_TrackedFree(void *ptr)
int SDLTest_TrackAllocations()
Start tracking SDL memory allocations.
static SDL_realloc_func SDL_realloc_orig
static SDL_free_func SDL_free_orig
void SDLTest_LogAllocations()
Print a log of any outstanding allocations.
static void * SDLTest_TrackedMalloc(size_t size)
static void SDL_UntrackAllocation(void *mem)
static SDL_malloc_func SDL_malloc_orig
static void * SDLTest_TrackedCalloc(size_t nmemb, size_t size)
static SDL_tracked_allocation * s_tracked_allocations[256]
static unsigned int get_allocation_bucket(void *mem)
static SDL_bool SDL_IsAllocationTracked(void *mem)
static void * SDLTest_TrackedRealloc(void *ptr, size_t size)
char stack_names[10][256]
struct SDL_tracked_allocation * next
static screen_context_t context