Updated memory interface for get_memory_usage_string. It now takes a pointer to a uint and optionally a char* to write the output buffers size to and the buffer pointer. It still returns the buffer pointer.

Fixed bug in dealloc where it would add to the memory used rather than subtract.
Added a zero-check to source-private get_eng_unit function to prevent dropping the unit to the minimum for a value of 0
Changed padding calculation to happen on every call to get_memory_usage_string rather than on the first call. As a result, it will now use minimum padding and ignore zero components. Merged zone and class name alignment values into one.
Fixed bug where the length of a user class/zone was not accounting for the prefix "USER_" by adding 5 to the result.
Made formatting change where by zone/class is tab indented and the values are double tab indented
This commit is contained in:
2025-06-24 15:43:06 +10:00
parent 7c2d6db2e7
commit 105edea0f3
2 changed files with 42 additions and 30 deletions

View File

@@ -71,7 +71,7 @@ namespace basalt
// Must be freed by user via dealloc with the tags;
// MEMORY_TAG_CLASS_STRING | MEMORY_TAG_ZONE_DEBUG | MEMORY_TAG_ALIGN_ANY
char* get_memory_usage_string(void);
char* get_memory_usage_string(u32* slen, char** memstr=nullptr);
i64 get_memory_tag_class_name(MEMORY_TAG memory_class, char* out_buf, u64 out_buf_size);
i64 get_memory_tag_zone_name(MEMORY_TAG memory_zone, char* out_buf, u64 out_buf_size);