| author | |
| committer | |
| log | c2eead9629b60a394aa61e6f96b89647eddce1ea |
| tree | a14ec292715a2ceb0cd9b8d018eee58449230256 |
| parent | 374e3e42e0de10d21406c077599cfc4a6a813497 |
2 files changed, 5 insertions(+), 3 deletions(-)
lib/std/heap.zig+5| ... | ... | @@ -714,6 +714,11 @@ test "PageAllocator" { |
| 714 | 714 | slice[127] = 0x34; |
| 715 | 715 | allocator.free(slice); |
| 716 | 716 | } |
| 717 | { | |
| 718 | var buf = try allocator.alloc(u8, mem.page_size + 1); | |
| 719 | defer allocator.free(buf); | |
| 720 | buf = try allocator.realloc(buf, 1); // shrink past the page boundary | |
| 721 | } | |
| 717 | 722 | } |
| 718 | 723 | |
| 719 | 724 | test "HeapAllocator" { |
lib/std/mem.zig-3| ... | ... | @@ -116,9 +116,6 @@ pub const Allocator = struct { |
| 116 | 116 | if (isAligned(@ptrToInt(old_mem.ptr), new_alignment)) { |
| 117 | 117 | if (new_byte_count <= old_mem.len) { |
| 118 | 118 | const shrunk_len = self.shrinkBytes(old_mem, new_byte_count, len_align); |
| 119 | if (shrunk_len < old_mem.len) { | |
| 120 | @memset(old_mem.ptr + shrunk_len, undefined, old_mem.len - shrunk_len); | |
| 121 | } | |
| 122 | 119 | return old_mem.ptr[0..shrunk_len]; |
| 123 | 120 | } |
| 124 | 121 | if (self.callResizeFn(old_mem, new_byte_count, len_align)) |resized_len| { |