From 9d0da1612e6abf4a05fd6461231f727238d71759 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 29 Sep 2020 00:24:17 -0700 Subject: [PATCH] langref: use general purpose allocator in the wasi example --- doc/langref.html.in | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/langref.html.in b/doc/langref.html.in index 320b10bbe5..870764f054 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -9889,12 +9889,13 @@ The result is 3 const std = @import("std"); pub fn main() !void { - // TODO a better default allocator that isn't as wasteful! - const args = try std.process.argsAlloc(std.heap.page_allocator); - defer std.process.argsFree(std.heap.page_allocator, args); + var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){}; + const gpa = &general_purpose_allocator.allocator; + const args = try std.process.argsAlloc(gpa); + defer std.process.argsFree(gpa, args); for (args) |arg, i| { - std.debug.print("{}: {}\n", .{i, arg}); + std.debug.print("{}: {}\n", .{ i, arg }); } } {#code_end#}