| author | |
| committer | |
| log | bd6f8d99c57004716333a3371fc6574fee534ecc |
| tree | 8d4ce59c9f3d384682ae789d1deb82df50b50043 |
| parent | 4cc9fe90a8a3c0bce803bf9fffd66477da9e37d0 |
1 files changed, 8 insertions(+), 0 deletions(-)
std/heap.zig+8| ... | ... | @@ -136,6 +136,14 @@ pub const IncrementingAllocator = struct { |
| 136 | 136 | } |
| 137 | 137 | }; |
| 138 | 138 | |
| 139 | test "c_allocator" { | |
| 140 | if (builtin.link_libc) { | |
| 141 | var slice = c_allocator.alloc(u8, 50) %% return; | |
| 142 | defer c_allocator.free(slice); | |
| 143 | slice = c_allocator.realloc(u8, slice, 100) %% return; | |
| 144 | } | |
| 145 | } | |
| 146 | ||
| 139 | 147 | test "IncrementingAllocator" { |
| 140 | 148 | const total_bytes = 100 * 1024 * 1024; |
| 141 | 149 | var inc_allocator = %%IncrementingAllocator.init(total_bytes); |