@@ -560,6 +560,7 @@ const tracy_full = struct {
560560 .vtable = &.{
561561 .alloc = alloc ,
562562 .resize = resize ,
563+ .remap = remap ,
563564 .free = free ,
564565 },
565566 };
@@ -568,11 +569,11 @@ const tracy_full = struct {
568569 fn alloc (
569570 ctx : * anyopaque ,
570571 len : usize ,
571- log2_ptr_align : u8 ,
572+ alignment : std.mem.Alignment ,
572573 ra : usize ,
573574 ) ? [* ]u8 {
574575 const self : * TracyAllocator = @ptrCast (@alignCast (ctx ));
575- const result = self .child_allocator .rawAlloc (len , log2_ptr_align , ra );
576+ const result = self .child_allocator .rawAlloc (len , alignment , ra );
576577 if (result ) | addr | {
577578 Alloc (addr , len );
578579 } else {
@@ -586,12 +587,12 @@ const tracy_full = struct {
586587 fn resize (
587588 ctx : * anyopaque ,
588589 buf : []u8 ,
589- log2_ptr_align : u8 ,
590+ alignment : std.mem.Alignment ,
590591 new_len : usize ,
591592 ra : usize ,
592593 ) bool {
593594 const self : * TracyAllocator = @ptrCast (@alignCast (ctx ));
594- const result = self .child_allocator .rawResize (buf , log2_ptr_align , new_len , ra );
595+ const result = self .child_allocator .rawResize (buf , alignment , new_len , ra );
595596 if (result ) {
596597 Free (buf .ptr );
597598 Alloc (buf .ptr , new_len );
@@ -603,14 +604,34 @@ const tracy_full = struct {
603604 return result ;
604605 }
605606
607+ fn remap (
608+ ctx : * anyopaque ,
609+ buf : []u8 ,
610+ alignment : std.mem.Alignment ,
611+ new_len : usize ,
612+ ra : usize ,
613+ ) ? [* ]u8 {
614+ const self : * TracyAllocator = @ptrCast (@alignCast (ctx ));
615+ const result = self .child_allocator .rawRemap (buf , alignment , new_len , ra );
616+ if (result ) | data | {
617+ Free (buf .ptr );
618+ Alloc (data , new_len );
619+ } else {
620+ var buffer : [128 ]u8 = undefined ;
621+ const msg = std .fmt .bufPrint (& buffer , "remap failed requesting {d} -> {d}" , .{ buf .len , new_len }) catch return result ;
622+ Message (msg );
623+ }
624+ return result ;
625+ }
626+
606627 fn free (
607628 ctx : * anyopaque ,
608629 buf : []u8 ,
609- log2_ptr_align : u8 ,
630+ alignment : std.mem.Alignment ,
610631 ra : usize ,
611632 ) void {
612633 const self : * TracyAllocator = @ptrCast (@alignCast (ctx ));
613- self .child_allocator .rawFree (buf , log2_ptr_align , ra );
634+ self .child_allocator .rawFree (buf , alignment , ra );
614635 Free (buf .ptr );
615636 }
616637 };
0 commit comments