mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
gpa: Add never_unmap and retain_metadata test
This commit is contained in:
parent
8a57e09b15
commit
d526a2cf95
@ -1458,3 +1458,19 @@ test "bug 9995 fix, large allocs count requested size not backing size" {
|
||||
buf = try allocator.realloc(buf, 2);
|
||||
try std.testing.expect(gpa.total_requested_bytes == 2);
|
||||
}
|
||||
|
||||
test "retain metadata and never unmap" {
|
||||
var gpa = std.heap.GeneralPurposeAllocator(.{
|
||||
.safety = true,
|
||||
.never_unmap = true,
|
||||
.retain_metadata = true,
|
||||
}){};
|
||||
defer std.debug.assert(gpa.deinit() == .ok);
|
||||
const allocator = gpa.allocator();
|
||||
|
||||
const alloc = try allocator.alloc(u8, 8);
|
||||
allocator.free(alloc);
|
||||
|
||||
const alloc2 = try allocator.alloc(u8, 8);
|
||||
allocator.free(alloc2);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user