Right now free does a memset to undefined, but destroy doesn't. There's no reason that should be inconsistent, right?
idk how to properly unit test something like this, does it need tests? For now I used a smoke test:
conststd=@import("std");pubfnmain()!void{varbuf:[1024]u8=undefined;varf:std.heap.FixedBufferAllocator=.init(&buf);consta=tryf.allocator().alloc(u8,1);a[0]=5;std.debug.print("a[0] = {}\n",.{a[0]});f.allocator().free(a);std.debug.print("a[0] = {}\n",.{a[0]});constp=tryf.allocator().create(u8);p.*=4;std.debug.print("p.* = {}\n",.{p.*});f.allocator().destroy(p);std.debug.print("p.* = {}\n",.{p.*});}
Output before this change:
a[0] = 5
a[0] = 170
p.* = 4
p.* = 4
Output after this change:
a[0] = 5
a[0] = 170
p.* = 4
p.* = 170
Right now `free` does a memset to undefined, but `destroy` doesn't. There's no reason that should be inconsistent, right?
---
idk how to properly unit test something like this, does it need tests? For now I used a smoke test:
```zig
const std = @import("std");
pub fn main() !void {
var buf: [1024]u8 = undefined;
var f: std.heap.FixedBufferAllocator = .init(&buf);
const a = try f.allocator().alloc(u8, 1);
a[0] = 5;
std.debug.print("a[0] = {}\n", .{a[0]});
f.allocator().free(a);
std.debug.print("a[0] = {}\n", .{a[0]});
const p = try f.allocator().create(u8);
p.* = 4;
std.debug.print("p.* = {}\n", .{p.*});
f.allocator().destroy(p);
std.debug.print("p.* = {}\n", .{p.*});
}
```
Output before this change:
```
a[0] = 5
a[0] = 170
p.* = 4
p.* = 4
```
Output after this change:
```
a[0] = 5
a[0] = 170
p.* = 4
p.* = 170
```