authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-03-10 14:17:40-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-03-11 01:55:49+01:00
logbd5dc75068dcfb3dcd6b8197ee5d941cacb15cb9
treef93e3c132f2233afd8466d3999d346e9544952b4
parent6015192fb62f4dac430a23227df21ab6368e8e07

std: remove GeneralPurposeAllocator alias


7 files changed, 8 insertions(+), 12 deletions(-)

doc/langref.html.in+1-1
......@@ -6368,7 +6368,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
63686368 </p>
63696369 <p>
63706370 Zig has a general purpose allocator available to be imported
6371 with {#syntax#}std.heap.GeneralPurposeAllocator{#endsyntax#}. However, it is still recommended to
6371 with {#syntax#}std.heap.DebugAllocator{#endsyntax#}. However, it is still recommended to
63726372 follow the {#link|Choosing an Allocator#} guide.
63736373 </p>
63746374
lib/compiler/aro/main.zig+1-1
......@@ -13,7 +13,7 @@ const assembly_backend = @import("assembly_backend");
1313var debug_allocator: std.heap.DebugAllocator(.{
1414 .stack_trace_frames = 0,
1515 // A unique value so that when a default-constructed
16 // GeneralPurposeAllocator is incorrectly passed to testing allocator, or
16 // DebugAllocator is incorrectly passed to testing allocator, or
1717 // vice versa, panic occurs.
1818 .canary = @truncate(0xc647026dc6875134),
1919}) = .{};
lib/std/hash/benchmark.zig+1-1
......@@ -440,7 +440,7 @@ pub fn main(init: std.process.Init) !void {
440440 std.process.exit(1);
441441 }
442442
443 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
443 var gpa: std.heap.DebugAllocator(.{}) = .init;
444444 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");
445445 const allocator = gpa.allocator();
446446
lib/std/heap.zig+1-5
......@@ -19,10 +19,6 @@ pub const BrkAllocator = @import("heap/BrkAllocator.zig");
1919pub const DebugAllocatorConfig = @import("heap/debug_allocator.zig").Config;
2020pub const DebugAllocator = @import("heap/debug_allocator.zig").DebugAllocator;
2121pub const Check = enum { ok, leak };
22/// Deprecated; to be removed after 0.14.0 is tagged.
23pub const GeneralPurposeAllocatorConfig = DebugAllocatorConfig;
24/// Deprecated; to be removed after 0.14.0 is tagged.
25pub const GeneralPurposeAllocator = DebugAllocator;
2622
2723/// A memory pool that can allocate objects of a single type very quickly.
2824/// 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) {
10061002test {
10071003 _ = @import("heap/memory_pool.zig");
10081004 _ = ArenaAllocator;
1009 _ = GeneralPurposeAllocator;
1005 _ = DebugAllocator(.{});
10101006 _ = FixedBufferAllocator;
10111007 if (builtin.single_threaded) {
10121008 if (builtin.cpu.arch.isWasm() or (builtin.os.tag == .linux and !builtin.link_libc)) {
lib/std/testing.zig+2-2
......@@ -19,11 +19,11 @@ var base_allocator_instance = std.heap.FixedBufferAllocator.init("");
1919
2020/// This should only be used in temporary test programs.
2121pub const allocator = allocator_instance.allocator();
22pub var allocator_instance: std.heap.GeneralPurposeAllocator(.{
22pub var allocator_instance: std.heap.DebugAllocator(.{
2323 .stack_trace_frames = if (std.debug.sys_can_stack_trace) 10 else 0,
2424 .resize_stack_traces = true,
2525 // A unique value so that when a default-constructed
26 // GeneralPurposeAllocator is incorrectly passed to testing allocator, or
26 // DebugAllocator is incorrectly passed to testing allocator, or
2727 // vice versa, panic occurs.
2828 .canary = @truncate(0x2731e675c3a701ba),
2929}) = b: {
test/standalone/child_process/main.zig+1-1
......@@ -3,7 +3,7 @@ const Io = std.Io;
33
44pub fn main(init: std.process.Init.Minimal) !void {
55 // make sure safety checks are enabled even in release modes
6 var gpa_state: std.heap.GeneralPurposeAllocator(.{ .safety = true }) = .{};
6 var gpa_state: std.heap.DebugAllocator(.{ .safety = true }) = .{};
77 defer if (gpa_state.deinit() != .ok) {
88 @panic("found memory leaks");
99 };
tools/generate_c_size_and_align_checks.zig+1-1
......@@ -26,7 +26,7 @@ fn cName(ty: std.Target.CType) []const u8 {
2626 };
2727}
2828
29var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
29var general_purpose_allocator: std.heap.DebugAllocator(.{}) = .init;
3030
3131pub fn main(init: std.process.Init) !void {
3232 const args = try init.minimal.args.toSlice(init.arena.allocator());