authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-08-08 02:15:34-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-08-08 02:15:34-07:00
log72b5ceed66005f03933a4e5bbd0eda08378b0fd0
treea7601d5ffb62d290e83e9fcd109d47073e38a00e
parent88ac0c128755b076cf357a9289e9ee847bf2794a

update langref in light of new general purpose allocator


1 files changed, 11 insertions(+), 3 deletions(-)

doc/langref.html.in+11-3
......@@ -9357,9 +9357,17 @@ pub fn main() !void {
93579357 is handled correctly? In this case, use {#syntax#}std.testing.FailingAllocator{#endsyntax#}.
93589358 </li>
93599359 <li>
9360 Finally, if none of the above apply, you need a general purpose allocator. Zig does not
9361 yet have a general purpose allocator in the standard library,
9362 <a href="https://github.com/andrewrk/zig-general-purpose-allocator/">but one is being actively developed</a>.
9360 Are you writing a test? In this case, use {#syntax#}std.testing.allocator{#endsyntax#}.
9361 </li>
9362 <li>
9363 Finally, if none of the above apply, you need a general purpose allocator.
9364 Zig's general purpose allocator is available as a function that takes a {#link|comptime#}
9365 {#link|struct#} of configuration options and returns a type.
9366 Generally, you will set up one {#syntax#}std.heap.GeneralPurposeAllocator#{endsyntax#} in
9367 your main function, and then pass it or sub-allocators around to various parts of your
9368 application.
9369 </li>
9370 <li>
93639371 You can also consider {#link|Implementing an Allocator#}.
93649372 </li>
93659373 </ol>