#include #include static ssize_t standing_allocations = 0; void *g_malloc(size_t size) { void *ptr = malloc(size); if (ptr == NULL) { return ptr; } standing_allocations++; return ptr; } void *g_calloc(size_t n_memb, size_t size) { void *ptr = calloc(n_memb, size); if (ptr == NULL) { return ptr; } standing_allocations++; return ptr; } void g_free(void *ptr) { free(ptr); standing_allocations--; } ssize_t g_outstanding_allocations() { return standing_allocations; }