| ... | ... | @@ -1458,3 +1458,19 @@ test "bug 9995 fix, large allocs count requested size not backing size" { |
| 1458 | 1458 | buf = try allocator.realloc(buf, 2); |
| 1459 | 1459 | try std.testing.expect(gpa.total_requested_bytes == 2); |
| 1460 | 1460 | } |
| 1461 | |
| 1462 | test "retain metadata and never unmap" { |
| 1463 | var gpa = std.heap.GeneralPurposeAllocator(.{ |
| 1464 | .safety = true, |
| 1465 | .never_unmap = true, |
| 1466 | .retain_metadata = true, |
| 1467 | }){}; |
| 1468 | defer std.debug.assert(gpa.deinit() == .ok); |
| 1469 | const allocator = gpa.allocator(); |
| 1470 | |
| 1471 | const alloc = try allocator.alloc(u8, 8); |
| 1472 | allocator.free(alloc); |
| 1473 | |
| 1474 | const alloc2 = try allocator.alloc(u8, 8); |
| 1475 | allocator.free(alloc2); |
| 1476 | } |