#if Enable_Debug {
// assert(hb_ptr.size & Allocated_Flag == Allocated_Flag, "Corrupted heap on free. This could be due to a double free, or using memory past were you allocated it.");
+ if cast(uintptr) hb_ptr < cast(uintptr) __heap_start {
+ log("FREEING STATIC DATA");
+ return;
+ }
+
if hb_ptr.size & Allocated_Flag != Allocated_Flag {
log("INVALID DOUBLE FREE");
return;
out := format_va(*buffer, format, va, flush);
buffer.count = out.count;
}
-#match format_va (format: [] u8, va: [] any) -> str {
+#match format_va (format: [] u8, va: [] any, allocator := context.allocator) -> str {
buffer : [256] u8;
- out := make([..] u8);
+ out := make([..] u8, allocator=allocator);
output := Format_Output.{
~~buffer, 0, buffer.count,
flush=.{ ^out, flush_to_dynstr }