From bd5dc75068dcfb3dcd6b8197ee5d941cacb15cb9 Mon Sep 17 00:00:00 2001
From: Meghan Denny
Zig has a general purpose allocator available to be imported - with {#syntax#}std.heap.GeneralPurposeAllocator{#endsyntax#}. However, it is still recommended to + with {#syntax#}std.heap.DebugAllocator{#endsyntax#}. However, it is still recommended to follow the {#link|Choosing an Allocator#} guide.
diff --git a/lib/compiler/aro/main.zig b/lib/compiler/aro/main.zig index dcc07eaca64c9c69ce67ef7121128c026e4c3cda..eafddba8778f78d9d0165594547cd04c4087219c 100644 --- a/lib/compiler/aro/main.zig +++ b/lib/compiler/aro/main.zig @@ -13,7 +13,7 @@ const assembly_backend = @import("assembly_backend"); var debug_allocator: std.heap.DebugAllocator(.{ .stack_trace_frames = 0, // A unique value so that when a default-constructed - // GeneralPurposeAllocator is incorrectly passed to testing allocator, or + // DebugAllocator is incorrectly passed to testing allocator, or // vice versa, panic occurs. .canary = @truncate(0xc647026dc6875134), }) = .{}; diff --git a/lib/std/hash/benchmark.zig b/lib/std/hash/benchmark.zig index 3e48351137abf57a35d9581bc5b6a820d3c5bec1..4b900a94a141a2ca24200181bdd4811b98538b3b 100644 --- a/lib/std/hash/benchmark.zig +++ b/lib/std/hash/benchmark.zig @@ -440,7 +440,7 @@ pub fn main(init: std.process.Init) !void { std.process.exit(1); } - var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; + var gpa: std.heap.DebugAllocator(.{}) = .init; defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak"); const allocator = gpa.allocator(); diff --git a/lib/std/heap.zig b/lib/std/heap.zig index cc8693f650c2d703542788971c132efed020d230..854a6e61335dfb6cec9a7f3cacaa97d6af00b6f5 100644 --- a/lib/std/heap.zig +++ b/lib/std/heap.zig @@ -19,10 +19,6 @@ pub const BrkAllocator = @import("heap/BrkAllocator.zig"); pub const DebugAllocatorConfig = @import("heap/debug_allocator.zig").Config; pub const DebugAllocator = @import("heap/debug_allocator.zig").DebugAllocator; pub const Check = enum { ok, leak }; -/// Deprecated; to be removed after 0.14.0 is tagged. -pub const GeneralPurposeAllocatorConfig = DebugAllocatorConfig; -/// Deprecated; to be removed after 0.14.0 is tagged. -pub const GeneralPurposeAllocator = DebugAllocator; /// A memory pool that can allocate objects of a single type very quickly. /// Use this when you need to allocate a lot of objects of the same type, @@ -1006,7 +1002,7 @@ const page_size_max_default: ?usize = switch (builtin.os.tag) { test { _ = @import("heap/memory_pool.zig"); _ = ArenaAllocator; - _ = GeneralPurposeAllocator; + _ = DebugAllocator(.{}); _ = FixedBufferAllocator; if (builtin.single_threaded) { if (builtin.cpu.arch.isWasm() or (builtin.os.tag == .linux and !builtin.link_libc)) { diff --git a/lib/std/testing.zig b/lib/std/testing.zig index bfb50039ea2272242ec911d739b00830bbc4360f..29e1fc8d61a7b4809f00ef1af9527d6da659a594 100644 --- a/lib/std/testing.zig +++ b/lib/std/testing.zig @@ -19,11 +19,11 @@ var base_allocator_instance = std.heap.FixedBufferAllocator.init(""); /// This should only be used in temporary test programs. pub const allocator = allocator_instance.allocator(); -pub var allocator_instance: std.heap.GeneralPurposeAllocator(.{ +pub var allocator_instance: std.heap.DebugAllocator(.{ .stack_trace_frames = if (std.debug.sys_can_stack_trace) 10 else 0, .resize_stack_traces = true, // A unique value so that when a default-constructed - // GeneralPurposeAllocator is incorrectly passed to testing allocator, or + // DebugAllocator is incorrectly passed to testing allocator, or // vice versa, panic occurs. .canary = @truncate(0x2731e675c3a701ba), }) = b: { diff --git a/test/standalone/child_process/main.zig b/test/standalone/child_process/main.zig index d252ee414d48a546654c939a411bddf99788f57c..c772d1b8215f891ac2c47d7a8212c47eb3273d80 100644 --- a/test/standalone/child_process/main.zig +++ b/test/standalone/child_process/main.zig @@ -3,7 +3,7 @@ const Io = std.Io; pub fn main(init: std.process.Init.Minimal) !void { // make sure safety checks are enabled even in release modes - var gpa_state: std.heap.GeneralPurposeAllocator(.{ .safety = true }) = .{}; + var gpa_state: std.heap.DebugAllocator(.{ .safety = true }) = .{}; defer if (gpa_state.deinit() != .ok) { @panic("found memory leaks"); }; diff --git a/tools/generate_c_size_and_align_checks.zig b/tools/generate_c_size_and_align_checks.zig index 6041a550da6f3ac04cf366cf9d1913c3cbbed5da..7f562dcac4d46bf1abca7e016d82587d10739129 100644 --- a/tools/generate_c_size_and_align_checks.zig +++ b/tools/generate_c_size_and_align_checks.zig @@ -26,7 +26,7 @@ fn cName(ty: std.Target.CType) []const u8 { }; } -var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init; +var general_purpose_allocator: std.heap.DebugAllocator(.{}) = .init; pub fn main(init: std.process.Init) !void { const args = try init.minimal.args.toSlice(init.arena.allocator()); -- 2.54.0