···15421542/**
15431543 * Get the number of outstanding (unfreed) allocations.
15441544 *
15451545- * \returns the number of allocations.
15451545+ * \returns the number of allocations or
15461546+ * -1 if allocation counting is disabled.
15461547 *
15471548 * \threadsafety It is safe to call this function from any thread.
15481549 *
+6-2
src/stdlib/SDL_malloc.c
···63536353};
6354635463556355// Define this if you want to track the number of allocations active
63566356-// #define TRACK_ALLOCATION_COUNT
63576357-#ifdef TRACK_ALLOCATION_COUNT
63566356+// #define SDL_TRACK_ALLOCATION_COUNT
63576357+#ifdef SDL_TRACK_ALLOCATION_COUNT
63586358#define INCREMENT_ALLOCATION_COUNT() (void)SDL_AtomicIncRef(&s_mem.num_allocations)
63596359#define DECREMENT_ALLOCATION_COUNT() (void)SDL_AtomicDecRef(&s_mem.num_allocations)
63606360#else
···6428642864296429int SDL_GetNumAllocations(void)
64306430{
64316431+#ifdef SDL_TRACK_ALLOCATION_COUNT
64316432 return SDL_GetAtomicInt(&s_mem.num_allocations);
64336433+#else
64346434+ return -1;
64356435+#endif
64326436}
6433643764346438void *SDL_malloc(size_t size)