[zone] Add function to retrieve memory usage

This commit is contained in:
Bill Currie 2021-12-27 20:12:03 +09:00
parent 06d14eb411
commit 1be220559a
2 changed files with 9 additions and 1 deletions

View file

@ -99,6 +99,7 @@ memhunk_t *Memory_Init (void *buf, size_t size);
void Z_ClearZone (memzone_t *zone, size_t size, size_t zone_offset,
size_t ele_size);
void Z_MemInfo (const memzone_t *zone, size_t *used, size_t *size);
void Z_Free (memzone_t *zone, void *ptr);
void *Z_Malloc (memzone_t *zone, size_t size); // returns 0 filled memory
void *Z_TagMalloc (memzone_t *zone, size_t size, int tag);

View file

@ -382,7 +382,7 @@ Z_SetError (memzone_t *zone, void (*err) (void *, const char *), void *data)
zone->data = data;
}
void
VISIBLE void
Z_CheckPointer (const memzone_t *zone, const void *ptr, size_t size)
{
const memblock_t *block;
@ -405,6 +405,13 @@ Z_CheckPointer (const memzone_t *zone, const void *ptr, size_t size)
}
}
VISIBLE void
Z_MemInfo (const memzone_t *zone, size_t *used, size_t *size)
{
*used = zone->used;
*size = zone->size;
}
//============================================================================
typedef struct cache_system_s cache_system_t;