From b950f8570501a084e12bddf18a2e27cc5bf48c5e Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Wed, 2 Apr 2025 20:00:18 -0700 Subject: [PATCH] Disable remap and resize in AllocationScope --- src/allocators/AllocationScope.zig | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/allocators/AllocationScope.zig b/src/allocators/AllocationScope.zig index 5e2f7e3c8b..3a5de1c633 100644 --- a/src/allocators/AllocationScope.zig +++ b/src/allocators/AllocationScope.zig @@ -73,8 +73,8 @@ pub fn allocator(scope: *AllocationScope) Allocator { const vtable: Allocator.VTable = .{ .alloc = alloc, - .resize = resize, - .remap = remap, + .resize = &std.mem.Allocator.noResize, + .remap = &std.mem.Allocator.noRemap, .free = free, }; @@ -95,16 +95,6 @@ fn alloc(ctx: *anyopaque, len: usize, alignment: std.mem.Alignment, ret_addr: us return result; } -fn resize(ctx: *anyopaque, buf: []u8, alignment: std.mem.Alignment, new_len: usize, ret_addr: usize) bool { - const scope: *AllocationScope = @ptrCast(@alignCast(ctx)); - return scope.parent.vtable.resize(scope.parent.ptr, buf, alignment, new_len, ret_addr); -} - -fn remap(ctx: *anyopaque, buf: []u8, alignment: std.mem.Alignment, new_len: usize, ret_addr: usize) ?[*]u8 { - const scope: *AllocationScope = @ptrCast(@alignCast(ctx)); - return scope.parent.vtable.remap(scope.parent.ptr, buf, alignment, new_len, ret_addr); -} - fn free(ctx: *anyopaque, buf: []u8, alignment: std.mem.Alignment, ret_addr: usize) void { const scope: *AllocationScope = @ptrCast(@alignCast(ctx)); scope.state.mutex.lock();