aboutsummaryrefslogtreecommitdiff
path: root/std/mutex.zig
diff options
context:
space:
mode:
authorSahnvour <sahnvour@pm.me>2019-06-22 16:33:00 +0200
committerAndrew Kelley <andrew@ziglang.org>2019-06-22 14:10:53 -0400
commit987c209b407f8379fd58381dcd3975982dfccdaf (patch)
tree6437a6aa96b60175c23a4eca8e9fad257ba440e2 /std/mutex.zig
parentbe51511d295269851ea4128f0fd3db49fe96a661 (diff)
downloadzig-987c209b407f8379fd58381dcd3975982dfccdaf.tar.gz
zig-987c209b407f8379fd58381dcd3975982dfccdaf.zip
heap: make one global instance of DirectAllocator
it is now stateless, so the de/init are not necessary anymore
Diffstat (limited to 'std/mutex.zig')
-rw-r--r--std/mutex.zig7
1 files changed, 2 insertions, 5 deletions
diff --git a/std/mutex.zig b/std/mutex.zig
index 6b8e586ea8..5f3b9272d9 100644
--- a/std/mutex.zig
+++ b/std/mutex.zig
@@ -130,11 +130,8 @@ const TestContext = struct {
};
test "std.Mutex" {
- var direct_allocator = std.heap.DirectAllocator.init();
- defer direct_allocator.deinit();
-
- var plenty_of_memory = try direct_allocator.allocator.alloc(u8, 300 * 1024);
- defer direct_allocator.allocator.free(plenty_of_memory);
+ var plenty_of_memory = try std.heap.direct_allocator.alloc(u8, 300 * 1024);
+ defer std.heap.direct_allocator.free(plenty_of_memory);
var fixed_buffer_allocator = std.heap.ThreadSafeFixedBufferAllocator.init(plenty_of_memory);
var a = &fixed_buffer_allocator.allocator;