authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-22 01:13:10-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-22 01:13:10-04:00
log726674b2bd0ac8159c961a944012b096d08e5615
tree360ef32752d804e10c8cb8093a0ed8dc1f5ca18b
parentb5f9033d8226019a043b89574dada3dd06d7d5fb
signaturelock-open Commit is signed but in an unrecognized format.

fix ArenaAllocator


2 files changed, 15 insertions(+), 15 deletions(-)

std/heap.zig+14-14
...@@ -368,9 +368,9 @@ pub const ArenaAllocator = struct {...@@ -368,9 +368,9 @@ pub const ArenaAllocator = struct {
368 var it = self.buffer_list.first;368 var it = self.buffer_list.first;
369 while (it) |node| {369 while (it) |node| {
370 // this has to occur before the free because the free frees node370 // this has to occur before the free because the free frees node
371 it = node.next;371 const next_it = node.next;
372
373 self.child_allocator.free(node.data);372 self.child_allocator.free(node.data);
373 it = next_it;
374 }374 }
375 }375 }
376376
...@@ -764,18 +764,18 @@ test "HeapAllocator" {...@@ -764,18 +764,18 @@ test "HeapAllocator" {
764 }764 }
765}765}
766766
767//test "ArenaAllocator" {767test "ArenaAllocator" {
768// var direct_allocator = DirectAllocator.init();768 var direct_allocator = DirectAllocator.init();
769// defer direct_allocator.deinit();769 defer direct_allocator.deinit();
770//770
771// var arena_allocator = ArenaAllocator.init(&direct_allocator.allocator);771 var arena_allocator = ArenaAllocator.init(&direct_allocator.allocator);
772// defer arena_allocator.deinit();772 defer arena_allocator.deinit();
773//773
774// try testAllocator(&arena_allocator.allocator);774 try testAllocator(&arena_allocator.allocator);
775// try testAllocatorAligned(&arena_allocator.allocator, 16);775 try testAllocatorAligned(&arena_allocator.allocator, 16);
776// try testAllocatorLargeAlignment(&arena_allocator.allocator);776 try testAllocatorLargeAlignment(&arena_allocator.allocator);
777// try testAllocatorAlignedShrink(&arena_allocator.allocator);777 try testAllocatorAlignedShrink(&arena_allocator.allocator);
778//}778}
779779
780var test_fixed_buffer_allocator_memory: [80000 * @sizeOf(u64)]u8 = undefined;780var test_fixed_buffer_allocator_memory: [80000 * @sizeOf(u64)]u8 = undefined;
781test "FixedBufferAllocator" {781test "FixedBufferAllocator" {
std/std.zig+1-1
...@@ -88,7 +88,7 @@ test "std" {...@@ -88,7 +88,7 @@ test "std" {
88 _ = @import("fmt.zig");88 _ = @import("fmt.zig");
89 _ = @import("fs.zig");89 _ = @import("fs.zig");
90 _ = @import("hash.zig");90 _ = @import("hash.zig");
91 _ = @import("heap.zig"); // TODO commented test91 _ = @import("heap.zig");
92 _ = @import("io.zig");92 _ = @import("io.zig");
93 //_ = @import("json.zig");93 //_ = @import("json.zig");
94 //_ = @import("lazy_init.zig");94 //_ = @import("lazy_init.zig");