2022-10-13 01:29:05 +00:00
|
|
|
#ifndef TELODENDRIA_MEMORY_H
|
|
|
|
#define TELODENDRIA_MEMORY_H
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
2022-10-13 12:50:27 +00:00
|
|
|
typedef enum MemoryAction
|
|
|
|
{
|
|
|
|
MEMORY_ALLOCATE,
|
|
|
|
MEMORY_REALLOCATE,
|
|
|
|
MEMORY_FREE
|
|
|
|
} MemoryAction;
|
|
|
|
|
2022-10-13 01:29:05 +00:00
|
|
|
#define Malloc(x) MemoryAllocate(x, __FILE__, __LINE__, __FUNCTION__)
|
|
|
|
#define Realloc(x, s) MemoryReallocate(x, s)
|
|
|
|
#define Free(x) MemoryFree(x)
|
|
|
|
|
|
|
|
typedef struct MemoryInfo MemoryInfo;
|
|
|
|
|
|
|
|
extern void *MemoryAllocate(size_t, const char *, int, const char *);
|
|
|
|
extern void *MemoryReallocate(void *, size_t);
|
|
|
|
extern void MemoryFree(void *);
|
|
|
|
|
|
|
|
extern size_t MemoryAllocated(void);
|
|
|
|
extern void MemoryFreeAll(void);
|
|
|
|
|
|
|
|
extern MemoryInfo * MemoryInfoGet(void *);
|
|
|
|
|
|
|
|
extern size_t MemoryInfoGetSize(MemoryInfo *);
|
|
|
|
extern const char * MemoryInfoGetFile(MemoryInfo *);
|
|
|
|
extern const char * MemoryInfoGetFunc(MemoryInfo *);
|
|
|
|
extern int MemoryInfoGetLine(MemoryInfo *);
|
|
|
|
extern void * MemoryInfoGetPointer(MemoryInfo *);
|
|
|
|
|
|
|
|
extern void MemoryIterate(void (*)(MemoryInfo *, void *), void *);
|
|
|
|
|
2022-10-13 12:50:27 +00:00
|
|
|
extern void MemoryHook(void (*)(MemoryAction, MemoryInfo *, void *), void *);
|
|
|
|
|
2022-10-13 01:29:05 +00:00
|
|
|
#endif
|