aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--std/heap.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/std/heap.zig b/std/heap.zig
index b654f28a74..3f67a97926 100644
--- a/std/heap.zig
+++ b/std/heap.zig
@@ -136,6 +136,14 @@ pub const IncrementingAllocator = struct {
}
};
+test "c_allocator" {
+ if (builtin.link_libc) {
+ var slice = c_allocator.alloc(u8, 50) %% return;
+ defer c_allocator.free(slice);
+ slice = c_allocator.realloc(u8, slice, 100) %% return;
+ }
+}
+
test "IncrementingAllocator" {
const total_bytes = 100 * 1024 * 1024;
var inc_allocator = %%IncrementingAllocator.init(total_bytes);