aboutsummaryrefslogtreecommitdiff
path: root/core/log
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-08-08 15:16:18 +0100
committergingerBill <bill@gingerbill.org>2022-08-08 15:16:18 +0100
commit659c3c528dbcb0d4121f511f2fe89c885f5998c9 (patch)
tree910f7abbe48ad7aa4fd721a658e916234487215d /core/log
parent60aeab3c38941925ccc2cba30e8bcaa896a53d96 (diff)
Update `delete` to pass size in bytes to free when possible
Diffstat (limited to 'core/log')
-rw-r--r--core/log/log_allocator.odin21
1 files changed, 15 insertions, 6 deletions
diff --git a/core/log/log_allocator.odin b/core/log/log_allocator.odin
index e703ee1a9..ea0ec37ba 100644
--- a/core/log/log_allocator.odin
+++ b/core/log/log_allocator.odin
@@ -36,12 +36,21 @@ log_allocator_proc :: proc(allocator_data: rawptr, mode: runtime.Allocator_Mode,
location = location,
)
case .Free:
- logf(
- level=la.level,
- fmt_str = "%s%s<<< ALLOCATOR(mode=.Free, ptr=%p, size=%d)",
- args = {la.prefix, " " if la.prefix != "" else "", old_memory, old_size},
- location = location,
- )
+ if old_size != 0 {
+ logf(
+ level=la.level,
+ fmt_str = "%s%s<<< ALLOCATOR(mode=.Free, ptr=%p, size=%d)",
+ args = {la.prefix, " " if la.prefix != "" else "", old_memory, old_size},
+ location = location,
+ )
+ } else {
+ logf(
+ level=la.level,
+ fmt_str = "%s%s<<< ALLOCATOR(mode=.Free, ptr=%p)",
+ args = {la.prefix, " " if la.prefix != "" else "", old_memory},
+ location = location,
+ )
+ }
case .Free_All:
logf(
level=la.level,