@@ -568,6 +568,7 @@ const tracy_full = struct {
568568 .vtable = &.{
569569 .alloc = alloc ,
570570 .resize = resize ,
571+ .remap = remap ,
571572 .free = free ,
572573 },
573574 };
@@ -576,11 +577,11 @@ const tracy_full = struct {
576577 fn alloc (
577578 ctx : * anyopaque ,
578579 len : usize ,
579- log2_ptr_align : u8 ,
580+ alignment : std.mem.Alignment ,
580581 ra : usize ,
581582 ) ? [* ]u8 {
582583 const self : * TracyAllocator = @ptrCast (@alignCast (ctx ));
583- const result = self .child_allocator .rawAlloc (len , log2_ptr_align , ra );
584+ const result = self .child_allocator .rawAlloc (len , alignment , ra );
584585 if (result ) | addr | {
585586 Alloc (addr , len );
586587 } else {
@@ -594,12 +595,12 @@ const tracy_full = struct {
594595 fn resize (
595596 ctx : * anyopaque ,
596597 buf : []u8 ,
597- log2_ptr_align : u8 ,
598+ alignment : std.mem.Alignment ,
598599 new_len : usize ,
599600 ra : usize ,
600601 ) bool {
601602 const self : * TracyAllocator = @ptrCast (@alignCast (ctx ));
602- const result = self .child_allocator .rawResize (buf , log2_ptr_align , new_len , ra );
603+ const result = self .child_allocator .rawResize (buf , alignment , new_len , ra );
603604 if (result ) {
604605 Free (buf .ptr );
605606 Alloc (buf .ptr , new_len );
@@ -611,14 +612,34 @@ const tracy_full = struct {
611612 return result ;
612613 }
613614
615+ fn remap (
616+ ctx : * anyopaque ,
617+ buf : []u8 ,
618+ alignment : std.mem.Alignment ,
619+ new_len : usize ,
620+ ra : usize ,
621+ ) ? [* ]u8 {
622+ const self : * TracyAllocator = @ptrCast (@alignCast (ctx ));
623+ const result = self .child_allocator .rawRemap (buf , alignment , new_len , ra );
624+ if (result ) | data | {
625+ Free (buf .ptr );
626+ Alloc (data , new_len );
627+ } else {
628+ var buffer : [128 ]u8 = undefined ;
629+ const msg = std .fmt .bufPrint (& buffer , "remap failed requesting {d} -> {d}" , .{ buf .len , new_len }) catch return result ;
630+ Message (msg );
631+ }
632+ return result ;
633+ }
634+
614635 fn free (
615636 ctx : * anyopaque ,
616637 buf : []u8 ,
617- log2_ptr_align : u8 ,
638+ alignment : std.mem.Alignment ,
618639 ra : usize ,
619640 ) void {
620641 const self : * TracyAllocator = @ptrCast (@alignCast (ctx ));
621- self .child_allocator .rawFree (buf , log2_ptr_align , ra );
642+ self .child_allocator .rawFree (buf , alignment , ra );
622643 Free (buf .ptr );
623644 }
624645 };
0 commit comments