aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/lib/allocator.zig
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/libghostty-vt/src/lib/allocator.zig')
-rw-r--r--vendor/libghostty-vt/src/lib/allocator.zig8
1 files changed, 6 insertions, 2 deletions
diff --git a/vendor/libghostty-vt/src/lib/allocator.zig b/vendor/libghostty-vt/src/lib/allocator.zig
index fc56033a..de343dab 100644
--- a/vendor/libghostty-vt/src/lib/allocator.zig
+++ b/vendor/libghostty-vt/src/lib/allocator.zig
@@ -2,8 +2,8 @@ const std = @import("std");
const builtin = @import("builtin");
const testing = std.testing;
-/// Convenience functions
-pub const convenience = @import("allocator/convenience.zig");
+/// Wasm-specific allocation helpers.
+pub const wasm = @import("allocator/wasm.zig");
/// Useful alias since they're required to create Zig allocators
pub const ZigVTable = std.mem.Allocator.VTable;
@@ -34,6 +34,10 @@ pub fn default(c_alloc_: ?*const Allocator) std.mem.Allocator {
// Wasm
if (comptime builtin.target.cpu.arch.isWasm()) return std.heap.wasm_allocator;
+ // Freestanding targets don't have a default heap. Using the failing
+ // allocator makes a missing allocator show up as out-of-memory.
+ if (comptime builtin.os.tag == .freestanding) return std.mem.Allocator.failing;
+
// No libc, use the preferred allocator for releases which is the
// Zig SMP allocator.
return std.heap.smp_allocator;