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...@@ -6368,7 +6368,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
6368 </p>6368 </p>
6369 <p>6369 <p>
6370 Zig has a general purpose allocator available to be imported6370 Zig has a general purpose allocator available to be imported
6371 with {#syntax#}std.heap.GeneralPurposeAllocator{#endsyntax#}. However, it is still recommended to6371 with {#syntax#}std.heap.DebugAllocator{#endsyntax#}. However, it is still recommended to
6372 follow the {#link|Choosing an Allocator#} guide.6372 follow the {#link|Choosing an Allocator#} guide.
6373 </p>6373 </p>
63746374
lib/compiler/aro/main.zig+1-1
...@@ -13,7 +13,7 @@ const assembly_backend = @import("assembly_backend");...@@ -13,7 +13,7 @@ const assembly_backend = @import("assembly_backend");
13var debug_allocator: std.heap.DebugAllocator(.{13var debug_allocator: std.heap.DebugAllocator(.{
14 .stack_trace_frames = 0,14 .stack_trace_frames = 0,
15 // A unique value so that when a default-constructed15 // A unique value so that when a default-constructed
16 // GeneralPurposeAllocator is incorrectly passed to testing allocator, or16 // DebugAllocator is incorrectly passed to testing allocator, or
17 // vice versa, panic occurs.17 // vice versa, panic occurs.
18 .canary = @truncate(0xc647026dc6875134),18 .canary = @truncate(0xc647026dc6875134),
19}) = .{};19}) = .{};
lib/std/hash/benchmark.zig+1-1
...@@ -440,7 +440,7 @@ pub fn main(init: std.process.Init) !void {...@@ -440,7 +440,7 @@ pub fn main(init: std.process.Init) !void {
440 std.process.exit(1);440 std.process.exit(1);
441 }441 }
442442
443 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;443 var gpa: std.heap.DebugAllocator(.{}) = .init;
444 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");444 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");
445 const allocator = gpa.allocator();445 const allocator = gpa.allocator();
446446
lib/std/heap.zig+1-5
...@@ -19,10 +19,6 @@ pub const BrkAllocator = @import("heap/BrkAllocator.zig");...@@ -19,10 +19,6 @@ pub const BrkAllocator = @import("heap/BrkAllocator.zig");
19pub const DebugAllocatorConfig = @import("heap/debug_allocator.zig").Config;19pub const DebugAllocatorConfig = @import("heap/debug_allocator.zig").Config;
20pub const DebugAllocator = @import("heap/debug_allocator.zig").DebugAllocator;20pub const DebugAllocator = @import("heap/debug_allocator.zig").DebugAllocator;
21pub const Check = enum { ok, leak };21pub 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
27/// A memory pool that can allocate objects of a single type very quickly.23/// A memory pool that can allocate objects of a single type very quickly.
28/// Use this when you need to allocate a lot of objects of the same type,24/// 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) {...@@ -1006,7 +1002,7 @@ const page_size_max_default: ?usize = switch (builtin.os.tag) {
1006test {1002test {
1007 _ = @import("heap/memory_pool.zig");1003 _ = @import("heap/memory_pool.zig");
1008 _ = ArenaAllocator;1004 _ = ArenaAllocator;
1009 _ = GeneralPurposeAllocator;1005 _ = DebugAllocator(.{});
1010 _ = FixedBufferAllocator;1006 _ = FixedBufferAllocator;
1011 if (builtin.single_threaded) {1007 if (builtin.single_threaded) {
1012 if (builtin.cpu.arch.isWasm() or (builtin.os.tag == .linux and !builtin.link_libc)) {1008 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("");...@@ -19,11 +19,11 @@ var base_allocator_instance = std.heap.FixedBufferAllocator.init("");
1919
20/// This should only be used in temporary test programs.20/// This should only be used in temporary test programs.
21pub const allocator = allocator_instance.allocator();21pub const allocator = allocator_instance.allocator();
22pub var allocator_instance: std.heap.GeneralPurposeAllocator(.{22pub var allocator_instance: std.heap.DebugAllocator(.{
23 .stack_trace_frames = if (std.debug.sys_can_stack_trace) 10 else 0,23 .stack_trace_frames = if (std.debug.sys_can_stack_trace) 10 else 0,
24 .resize_stack_traces = true,24 .resize_stack_traces = true,
25 // A unique value so that when a default-constructed25 // A unique value so that when a default-constructed
26 // GeneralPurposeAllocator is incorrectly passed to testing allocator, or26 // DebugAllocator is incorrectly passed to testing allocator, or
27 // vice versa, panic occurs.27 // vice versa, panic occurs.
28 .canary = @truncate(0x2731e675c3a701ba),28 .canary = @truncate(0x2731e675c3a701ba),
29}) = b: {29}) = b: {
test/standalone/child_process/main.zig+1-1
...@@ -3,7 +3,7 @@ const Io = std.Io;...@@ -3,7 +3,7 @@ const Io = std.Io;
33
4pub fn main(init: std.process.Init.Minimal) !void {4pub fn main(init: std.process.Init.Minimal) !void {
5 // make sure safety checks are enabled even in release modes5 // 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 }) = .{};
7 defer if (gpa_state.deinit() != .ok) {7 defer if (gpa_state.deinit() != .ok) {
8 @panic("found memory leaks");8 @panic("found memory leaks");
9 };9 };
tools/generate_c_size_and_align_checks.zig+1-1
...@@ -26,7 +26,7 @@ fn cName(ty: std.Target.CType) []const u8 {...@@ -26,7 +26,7 @@ fn cName(ty: std.Target.CType) []const u8 {
26 };26 };
27}27}
2828
29var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;29var general_purpose_allocator: std.heap.DebugAllocator(.{}) = .init;
3030
31pub fn main(init: std.process.Init) !void {31pub fn main(init: std.process.Init) !void {
32 const args = try init.minimal.args.toSlice(init.arena.allocator());32 const args = try init.minimal.args.toSlice(init.arena.allocator());