@@ -568,6 +568,7 @@ const tracy_full = struct {
568
568
.vtable = &.{
569
569
.alloc = alloc ,
570
570
.resize = resize ,
571
+ .remap = remap ,
571
572
.free = free ,
572
573
},
573
574
};
@@ -576,11 +577,11 @@ const tracy_full = struct {
576
577
fn alloc (
577
578
ctx : * anyopaque ,
578
579
len : usize ,
579
- log2_ptr_align : u8 ,
580
+ alignment : std.mem.Alignment ,
580
581
ra : usize ,
581
582
) ? [* ]u8 {
582
583
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 );
584
585
if (result ) | addr | {
585
586
Alloc (addr , len );
586
587
} else {
@@ -594,12 +595,12 @@ const tracy_full = struct {
594
595
fn resize (
595
596
ctx : * anyopaque ,
596
597
buf : []u8 ,
597
- log2_ptr_align : u8 ,
598
+ alignment : std.mem.Alignment ,
598
599
new_len : usize ,
599
600
ra : usize ,
600
601
) bool {
601
602
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 );
603
604
if (result ) {
604
605
Free (buf .ptr );
605
606
Alloc (buf .ptr , new_len );
@@ -611,14 +612,34 @@ const tracy_full = struct {
611
612
return result ;
612
613
}
613
614
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
+
614
635
fn free (
615
636
ctx : * anyopaque ,
616
637
buf : []u8 ,
617
- log2_ptr_align : u8 ,
638
+ alignment : std.mem.Alignment ,
618
639
ra : usize ,
619
640
) void {
620
641
const self : * TracyAllocator = @ptrCast (@alignCast (ctx ));
621
- self .child_allocator .rawFree (buf , log2_ptr_align , ra );
642
+ self .child_allocator .rawFree (buf , alignment , ra );
622
643
Free (buf .ptr );
623
644
}
624
645
};
0 commit comments